User Guide
all.hpp
Go to the documentation of this file.
1 /*************************************************************************
2  * Copyright (C) 2018-2019 Blue Brain Project
3  *
4  * This file is part of NMODL distributed under the terms of the GNU
5  * Lesser General Public License. See top-level LICENSE file for details.
6  *************************************************************************/
7 
8 ///
9 /// THIS FILE IS GENERATED AT BUILD TIME AND SHALL NOT BE EDITED.
10 ///
11 
12 #pragma once
13 
14 /**
15  * \dir
16  * \brief Auto generated AST Implementations
17  *
18  * \file
19  * \brief Auto generated AST classes declaration
20  */
21 
22 #include "ast/ast.hpp"
23 
24 #ifndef NMODL_AST_NODE_HPP
25 #define NMODL_AST_NODE_HPP
26 
27 namespace nmodl {
28 namespace ast {
29 
30 /**
31  * @addtogroup ast_class
32  * @ingroup ast
33  * @{
34  */
35 
36 /**
37  * \brief Base class for all AST node
38  *
39  * Base class for all nodes in the AST. This can replace ast::Ast in
40  * the next refactoring.
41  *
42  */
43 class Node : public Ast {
44 
45 public:
46  /// \name Ctor & dtor
47  /// \{
48 
49  virtual ~Node() = default;
50 
51  /// \}
52 
53  /**
54  * \brief Check if the ast node is an instance of ast::Node
55  * \return true as object is of type ast::Node
56  */
57  bool is_node() const noexcept override { return true; }
58 
59  /**
60  * \brief Return a copy of the current node
61  *
62  * Recursively make a new copy/clone of the current node including
63  * all members and return a pointer to the node. This is used for
64  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
65  * ast.
66  *
67  * @return pointer to the clone/copy of the current node
68  */
69  virtual Node *clone() const override { return new Node(*this); }
70 
71  /// \name Getters
72  /// \{
73 
74  /**
75  * \brief Return type (ast::AstNodeType) of ast node
76  *
77  * Every node in the ast has a type defined in ast::AstNodeType and this
78  * function is used to retrieve the same.
79  *
80  * \return ast node type i.e. ast::AstNodeType::NODE
81  *
82  * \sa Ast::get_node_type_name
83  */
84  virtual AstNodeType get_node_type() const noexcept override {
85  return AstNodeType::NODE;
86  }
87 
88  /**
89  * \brief Return type (ast::AstNodeType) of ast node as std::string
90  *
91  * Every node in the ast has a type defined in ast::AstNodeType.
92  * This type name can be returned as a std::string for printing
93  * node to text/json form.
94  *
95  * \return name of the node type as a string i.e. "Node"
96  *
97  * \sa Ast::get_node_name
98  */
99  virtual std::string get_node_type_name() const noexcept override {
100  return "Node";
101  }
102 
103  /**
104  * \brief Get std::shared_ptr from `this` pointer of the current ast node
105  */
106  virtual std::shared_ptr<Ast> get_shared_ptr() override {
107  return std::static_pointer_cast<Node>(shared_from_this());
108  }
109 
110  /**
111  * \brief Get std::shared_ptr from `this` pointer of the current ast node
112  */
113  virtual std::shared_ptr<const Ast> get_shared_ptr() const override {
114  return std::static_pointer_cast<const Node>(shared_from_this());
115  }
116 
117  /// \}
118 
119  /// \name Visitor
120  /// \{
121 
122  /**
123  * \brief visit children i.e. member variables of current node using provided
124  * visitor
125  *
126  * Different nodes in the AST have different members (i.e. children). This
127  * method recursively visits children using provided visitor.
128  *
129  * \param v Concrete visitor that will be used to recursively visit children
130  *
131  * \sa Ast::visit_children for example.
132  */
133  virtual void visit_children(visitor::Visitor &v) override;
134 
135  /**
136  * \brief visit children i.e. member variables of current node using provided
137  * visitor
138  *
139  * Different nodes in the AST have different members (i.e. children). This
140  * method recursively visits children using provided visitor.
141  *
142  * \param v Concrete constant visitor that will be used to recursively visit
143  * children
144  *
145  * \sa Ast::visit_children for example.
146  */
147  virtual void visit_children(visitor::ConstVisitor &v) const override;
148 
149  /**
150  * \brief accept (or visit) the current AST node using provided visitor
151  *
152  * Instead of visiting children of AST node, like Ast::visit_children,
153  * accept allows to visit the current node itself using provided concrete
154  * visitor.
155  *
156  * \param v Concrete visitor that will be used to recursively visit node
157  *
158  * \sa Ast::accept for example.
159  */
160  virtual void accept(visitor::Visitor &v) override;
161 
162  /**
163  * \copydoc accept(visitor::Visitor&)
164  */
165  virtual void accept(visitor::ConstVisitor &v) const override;
166 
167  /// \}
168 };
169 
170 /** @} */ // end of ast_class
171 
172 } // namespace ast
173 } // namespace nmodl
174 #endif // !NMODL_AST_NODE_HPP
175 #ifndef NMODL_AST_STATEMENT_HPP
176 #define NMODL_AST_STATEMENT_HPP
177 
178 namespace nmodl {
179 namespace ast {
180 
181 /**
182  * @addtogroup ast_class
183  * @ingroup ast
184  * @{
185  */
186 
187 /**
188  * \brief TODO
189  *
190  *
191  */
192 class Statement : public Node {
193 
194 public:
195  /// \name Ctor & dtor
196  /// \{
197 
198  virtual ~Statement() = default;
199 
200  /// \}
201 
202  /**
203  * \brief Check if the ast node is an instance of ast::Statement
204  * \return true as object is of type ast::Statement
205  */
206  bool is_statement() const noexcept override { return true; }
207 
208  /**
209  * \brief Return a copy of the current node
210  *
211  * Recursively make a new copy/clone of the current node including
212  * all members and return a pointer to the node. This is used for
213  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
214  * ast.
215  *
216  * @return pointer to the clone/copy of the current node
217  */
218  virtual Statement *clone() const override { return new Statement(*this); }
219 
220  /// \name Getters
221  /// \{
222 
223  /**
224  * \brief Return type (ast::AstNodeType) of ast node
225  *
226  * Every node in the ast has a type defined in ast::AstNodeType and this
227  * function is used to retrieve the same.
228  *
229  * \return ast node type i.e. ast::AstNodeType::STATEMENT
230  *
231  * \sa Ast::get_node_type_name
232  */
233  virtual AstNodeType get_node_type() const noexcept override {
234  return AstNodeType::STATEMENT;
235  }
236 
237  /**
238  * \brief Return type (ast::AstNodeType) of ast node as std::string
239  *
240  * Every node in the ast has a type defined in ast::AstNodeType.
241  * This type name can be returned as a std::string for printing
242  * node to text/json form.
243  *
244  * \return name of the node type as a string i.e. "Statement"
245  *
246  * \sa Ast::get_node_name
247  */
248  virtual std::string get_node_type_name() const noexcept override {
249  return "Statement";
250  }
251 
252  /**
253  * \brief Get std::shared_ptr from `this` pointer of the current ast node
254  */
255  virtual std::shared_ptr<Ast> get_shared_ptr() override {
256  return std::static_pointer_cast<Statement>(shared_from_this());
257  }
258 
259  /**
260  * \brief Get std::shared_ptr from `this` pointer of the current ast node
261  */
262  virtual std::shared_ptr<const Ast> get_shared_ptr() const override {
263  return std::static_pointer_cast<const Statement>(shared_from_this());
264  }
265 
266  /// \}
267 
268  /// \name Visitor
269  /// \{
270 
271  /**
272  * \brief visit children i.e. member variables of current node using provided
273  * visitor
274  *
275  * Different nodes in the AST have different members (i.e. children). This
276  * method recursively visits children using provided visitor.
277  *
278  * \param v Concrete visitor that will be used to recursively visit children
279  *
280  * \sa Ast::visit_children for example.
281  */
282  virtual void visit_children(visitor::Visitor &v) override;
283 
284  /**
285  * \brief visit children i.e. member variables of current node using provided
286  * visitor
287  *
288  * Different nodes in the AST have different members (i.e. children). This
289  * method recursively visits children using provided visitor.
290  *
291  * \param v Concrete constant visitor that will be used to recursively visit
292  * children
293  *
294  * \sa Ast::visit_children for example.
295  */
296  virtual void visit_children(visitor::ConstVisitor &v) const override;
297 
298  /**
299  * \brief accept (or visit) the current AST node using provided visitor
300  *
301  * Instead of visiting children of AST node, like Ast::visit_children,
302  * accept allows to visit the current node itself using provided concrete
303  * visitor.
304  *
305  * \param v Concrete visitor that will be used to recursively visit node
306  *
307  * \sa Ast::accept for example.
308  */
309  virtual void accept(visitor::Visitor &v) override;
310 
311  /**
312  * \copydoc accept(visitor::Visitor&)
313  */
314  virtual void accept(visitor::ConstVisitor &v) const override;
315 
316  /// \}
317 };
318 
319 /** @} */ // end of ast_class
320 
321 } // namespace ast
322 } // namespace nmodl
323 #endif // !NMODL_AST_STATEMENT_HPP
324 #ifndef NMODL_AST_EXPRESSION_HPP
325 #define NMODL_AST_EXPRESSION_HPP
326 
327 namespace nmodl {
328 namespace ast {
329 
330 /**
331  * @addtogroup ast_class
332  * @ingroup ast
333  * @{
334  */
335 
336 /**
337  * \brief Base class for all expressions in the NMODL
338  *
339  * Base class for all expression types. This is one of the top level node
340  * in the AST representing higher level expression constructs. %Expressions
341  * can be a variable itself or complex binary expressions.
342  *
343  * \sa ast::Statement
344  *
345  */
346 class Expression : public Node {
347 
348 public:
349  /// \name Ctor & dtor
350  /// \{
351 
352  virtual ~Expression() = default;
353 
354  /// \}
355 
356  /**
357  * \brief Check if the ast node is an instance of ast::Expression
358  * \return true as object is of type ast::Expression
359  */
360  bool is_expression() const noexcept override { return true; }
361 
362  /**
363  * \brief Return a copy of the current node
364  *
365  * Recursively make a new copy/clone of the current node including
366  * all members and return a pointer to the node. This is used for
367  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
368  * ast.
369  *
370  * @return pointer to the clone/copy of the current node
371  */
372  virtual Expression *clone() const override { return new Expression(*this); }
373 
374  /// \name Getters
375  /// \{
376 
377  /**
378  * \brief Return type (ast::AstNodeType) of ast node
379  *
380  * Every node in the ast has a type defined in ast::AstNodeType and this
381  * function is used to retrieve the same.
382  *
383  * \return ast node type i.e. ast::AstNodeType::EXPRESSION
384  *
385  * \sa Ast::get_node_type_name
386  */
387  virtual AstNodeType get_node_type() const noexcept override {
389  }
390 
391  /**
392  * \brief Return type (ast::AstNodeType) of ast node as std::string
393  *
394  * Every node in the ast has a type defined in ast::AstNodeType.
395  * This type name can be returned as a std::string for printing
396  * node to text/json form.
397  *
398  * \return name of the node type as a string i.e. "Expression"
399  *
400  * \sa Ast::get_node_name
401  */
402  virtual std::string get_node_type_name() const noexcept override {
403  return "Expression";
404  }
405 
406  /**
407  * \brief Get std::shared_ptr from `this` pointer of the current ast node
408  */
409  virtual std::shared_ptr<Ast> get_shared_ptr() override {
410  return std::static_pointer_cast<Expression>(shared_from_this());
411  }
412 
413  /**
414  * \brief Get std::shared_ptr from `this` pointer of the current ast node
415  */
416  virtual std::shared_ptr<const Ast> get_shared_ptr() const override {
417  return std::static_pointer_cast<const Expression>(shared_from_this());
418  }
419 
420  /// \}
421 
422  /// \name Visitor
423  /// \{
424 
425  /**
426  * \brief visit children i.e. member variables of current node using provided
427  * visitor
428  *
429  * Different nodes in the AST have different members (i.e. children). This
430  * method recursively visits children using provided visitor.
431  *
432  * \param v Concrete visitor that will be used to recursively visit children
433  *
434  * \sa Ast::visit_children for example.
435  */
436  virtual void visit_children(visitor::Visitor &v) override;
437 
438  /**
439  * \brief visit children i.e. member variables of current node using provided
440  * visitor
441  *
442  * Different nodes in the AST have different members (i.e. children). This
443  * method recursively visits children using provided visitor.
444  *
445  * \param v Concrete constant visitor that will be used to recursively visit
446  * children
447  *
448  * \sa Ast::visit_children for example.
449  */
450  virtual void visit_children(visitor::ConstVisitor &v) const override;
451 
452  /**
453  * \brief accept (or visit) the current AST node using provided visitor
454  *
455  * Instead of visiting children of AST node, like Ast::visit_children,
456  * accept allows to visit the current node itself using provided concrete
457  * visitor.
458  *
459  * \param v Concrete visitor that will be used to recursively visit node
460  *
461  * \sa Ast::accept for example.
462  */
463  virtual void accept(visitor::Visitor &v) override;
464 
465  /**
466  * \copydoc accept(visitor::Visitor&)
467  */
468  virtual void accept(visitor::ConstVisitor &v) const override;
469 
470  /// \}
471 };
472 
473 /** @} */ // end of ast_class
474 
475 } // namespace ast
476 } // namespace nmodl
477 #endif // !NMODL_AST_EXPRESSION_HPP
478 #ifndef NMODL_AST_BLOCK_HPP
479 #define NMODL_AST_BLOCK_HPP
480 
481 namespace nmodl {
482 namespace ast {
483 
484 /**
485  * @addtogroup ast_class
486  * @ingroup ast
487  * @{
488  */
489 
490 /**
491  * \brief Base class for all block scoped nodes
492  *
493  * NMODL has different local and global block scoped nodes like
494  * ast::NeuronBlock, ast::ParamBlock, ast::IfStatement etc. Ast::Block
495  * is base class and defines common interface for these nodes.
496  *
497  */
498 class Block : public Expression {
499 
500 public:
501  /// \name Ctor & dtor
502  /// \{
503 
504  virtual ~Block() = default;
505 
506  /// \}
507 
508  /// \name Not implemented
509  /// \{
510 
511  virtual const ArgumentVector &get_parameters() const {
512  throw std::runtime_error("get_parameters not implemented");
513  }
514 
515  /// \}
516 
517  /**
518  * \brief Check if the ast node is an instance of ast::Block
519  * \return true as object is of type ast::Block
520  */
521  bool is_block() const noexcept override { return true; }
522 
523  /**
524  * \brief Return a copy of the current node
525  *
526  * Recursively make a new copy/clone of the current node including
527  * all members and return a pointer to the node. This is used for
528  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
529  * ast.
530  *
531  * @return pointer to the clone/copy of the current node
532  */
533  virtual Block *clone() const override { return new Block(*this); }
534 
535  /// \name Getters
536  /// \{
537 
538  /**
539  * \brief Return type (ast::AstNodeType) of ast node
540  *
541  * Every node in the ast has a type defined in ast::AstNodeType and this
542  * function is used to retrieve the same.
543  *
544  * \return ast node type i.e. ast::AstNodeType::BLOCK
545  *
546  * \sa Ast::get_node_type_name
547  */
548  virtual AstNodeType get_node_type() const noexcept override {
549  return AstNodeType::BLOCK;
550  }
551 
552  /**
553  * \brief Return type (ast::AstNodeType) of ast node as std::string
554  *
555  * Every node in the ast has a type defined in ast::AstNodeType.
556  * This type name can be returned as a std::string for printing
557  * node to text/json form.
558  *
559  * \return name of the node type as a string i.e. "Block"
560  *
561  * \sa Ast::get_node_name
562  */
563  virtual std::string get_node_type_name() const noexcept override {
564  return "Block";
565  }
566 
567  /**
568  * \brief Get std::shared_ptr from `this` pointer of the current ast node
569  */
570  virtual std::shared_ptr<Ast> get_shared_ptr() override {
571  return std::static_pointer_cast<Block>(shared_from_this());
572  }
573 
574  /**
575  * \brief Get std::shared_ptr from `this` pointer of the current ast node
576  */
577  virtual std::shared_ptr<const Ast> get_shared_ptr() const override {
578  return std::static_pointer_cast<const Block>(shared_from_this());
579  }
580 
581  /// \}
582 
583  /// \name Visitor
584  /// \{
585 
586  /**
587  * \brief visit children i.e. member variables of current node using provided
588  * visitor
589  *
590  * Different nodes in the AST have different members (i.e. children). This
591  * method recursively visits children using provided visitor.
592  *
593  * \param v Concrete visitor that will be used to recursively visit children
594  *
595  * \sa Ast::visit_children for example.
596  */
597  virtual void visit_children(visitor::Visitor &v) override;
598 
599  /**
600  * \brief visit children i.e. member variables of current node using provided
601  * visitor
602  *
603  * Different nodes in the AST have different members (i.e. children). This
604  * method recursively visits children using provided visitor.
605  *
606  * \param v Concrete constant visitor that will be used to recursively visit
607  * children
608  *
609  * \sa Ast::visit_children for example.
610  */
611  virtual void visit_children(visitor::ConstVisitor &v) const override;
612 
613  /**
614  * \brief accept (or visit) the current AST node using provided visitor
615  *
616  * Instead of visiting children of AST node, like Ast::visit_children,
617  * accept allows to visit the current node itself using provided concrete
618  * visitor.
619  *
620  * \param v Concrete visitor that will be used to recursively visit node
621  *
622  * \sa Ast::accept for example.
623  */
624  virtual void accept(visitor::Visitor &v) override;
625 
626  /**
627  * \copydoc accept(visitor::Visitor&)
628  */
629  virtual void accept(visitor::ConstVisitor &v) const override;
630 
631  /// \}
632 };
633 
634 /** @} */ // end of ast_class
635 
636 } // namespace ast
637 } // namespace nmodl
638 #endif // !NMODL_AST_BLOCK_HPP
639 #ifndef NMODL_AST_IDENTIFIER_HPP
640 #define NMODL_AST_IDENTIFIER_HPP
641 
642 namespace nmodl {
643 namespace ast {
644 
645 /**
646  * @addtogroup ast_class
647  * @ingroup ast
648  * @{
649  */
650 
651 /**
652  * \brief Base class for all identifiers
653  *
654  * Base class for all variable types like ast::Name, ast::PrimeName and
655  * ast::Argument.
656  *
657  * \sa ast::Number
658  *
659  */
660 class Identifier : public Expression {
661 
662 public:
663  /// \name Ctor & dtor
664  /// \{
665 
666  virtual ~Identifier() = default;
667 
668  /// \}
669 
670  /**
671  * \brief Check if the ast node is an instance of ast::Identifier
672  * \return true as object is of type ast::Identifier
673  */
674  bool is_identifier() const noexcept override { return true; }
675 
676  /**
677  * \brief Return a copy of the current node
678  *
679  * Recursively make a new copy/clone of the current node including
680  * all members and return a pointer to the node. This is used for
681  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
682  * ast.
683  *
684  * @return pointer to the clone/copy of the current node
685  */
686  virtual Identifier *clone() const override { return new Identifier(*this); }
687 
688  /// \name Getters
689  /// \{
690 
691  /**
692  * \brief Return type (ast::AstNodeType) of ast node
693  *
694  * Every node in the ast has a type defined in ast::AstNodeType and this
695  * function is used to retrieve the same.
696  *
697  * \return ast node type i.e. ast::AstNodeType::IDENTIFIER
698  *
699  * \sa Ast::get_node_type_name
700  */
701  virtual AstNodeType get_node_type() const noexcept override {
703  }
704 
705  /**
706  * \brief Return type (ast::AstNodeType) of ast node as std::string
707  *
708  * Every node in the ast has a type defined in ast::AstNodeType.
709  * This type name can be returned as a std::string for printing
710  * node to text/json form.
711  *
712  * \return name of the node type as a string i.e. "Identifier"
713  *
714  * \sa Ast::get_node_name
715  */
716  virtual std::string get_node_type_name() const noexcept override {
717  return "Identifier";
718  }
719 
720  /**
721  * \brief Get std::shared_ptr from `this` pointer of the current ast node
722  */
723  virtual std::shared_ptr<Ast> get_shared_ptr() override {
724  return std::static_pointer_cast<Identifier>(shared_from_this());
725  }
726 
727  /**
728  * \brief Get std::shared_ptr from `this` pointer of the current ast node
729  */
730  virtual std::shared_ptr<const Ast> get_shared_ptr() const override {
731  return std::static_pointer_cast<const Identifier>(shared_from_this());
732  }
733 
734  /// \}
735 
736  /// \name Visitor
737  /// \{
738 
739  /**
740  * \brief visit children i.e. member variables of current node using provided
741  * visitor
742  *
743  * Different nodes in the AST have different members (i.e. children). This
744  * method recursively visits children using provided visitor.
745  *
746  * \param v Concrete visitor that will be used to recursively visit children
747  *
748  * \sa Ast::visit_children for example.
749  */
750  virtual void visit_children(visitor::Visitor &v) override;
751 
752  /**
753  * \brief visit children i.e. member variables of current node using provided
754  * visitor
755  *
756  * Different nodes in the AST have different members (i.e. children). This
757  * method recursively visits children using provided visitor.
758  *
759  * \param v Concrete constant visitor that will be used to recursively visit
760  * children
761  *
762  * \sa Ast::visit_children for example.
763  */
764  virtual void visit_children(visitor::ConstVisitor &v) const override;
765 
766  /**
767  * \brief accept (or visit) the current AST node using provided visitor
768  *
769  * Instead of visiting children of AST node, like Ast::visit_children,
770  * accept allows to visit the current node itself using provided concrete
771  * visitor.
772  *
773  * \param v Concrete visitor that will be used to recursively visit node
774  *
775  * \sa Ast::accept for example.
776  */
777  virtual void accept(visitor::Visitor &v) override;
778 
779  /**
780  * \copydoc accept(visitor::Visitor&)
781  */
782  virtual void accept(visitor::ConstVisitor &v) const override;
783 
784  /// \}
785 };
786 
787 /** @} */ // end of ast_class
788 
789 } // namespace ast
790 } // namespace nmodl
791 #endif // !NMODL_AST_IDENTIFIER_HPP
792 #ifndef NMODL_AST_NUMBER_HPP
793 #define NMODL_AST_NUMBER_HPP
794 
795 namespace nmodl {
796 namespace ast {
797 
798 /**
799  * @addtogroup ast_class
800  * @ingroup ast
801  * @{
802  */
803 
804 /**
805  * \brief Base class for all numbers
806  *
807  * Base class for all number types like ast::Integer, ast::Float and
808  * ast::Double.
809  *
810  */
811 class Number : public Expression {
812 
813 public:
814  /// \name Ctor & dtor
815  /// \{
816 
817  virtual ~Number() = default;
818 
819  /// \}
820 
821  /// \name Not implemented
822  /// \{
823 
824  virtual double to_double() {
825  throw std::runtime_error("to_double not implemented");
826  }
827 
828  /// \}
829 
830  /**
831  * \brief Check if the ast node is an instance of ast::Number
832  * \return true as object is of type ast::Number
833  */
834  bool is_number() const noexcept override { return true; }
835 
836  /**
837  * \brief Return a copy of the current node
838  *
839  * Recursively make a new copy/clone of the current node including
840  * all members and return a pointer to the node. This is used for
841  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
842  * ast.
843  *
844  * @return pointer to the clone/copy of the current node
845  */
846  virtual Number *clone() const override { return new Number(*this); }
847 
848  /// \name Getters
849  /// \{
850 
851  /**
852  * \brief Return type (ast::AstNodeType) of ast node
853  *
854  * Every node in the ast has a type defined in ast::AstNodeType and this
855  * function is used to retrieve the same.
856  *
857  * \return ast node type i.e. ast::AstNodeType::NUMBER
858  *
859  * \sa Ast::get_node_type_name
860  */
861  virtual AstNodeType get_node_type() const noexcept override {
862  return AstNodeType::NUMBER;
863  }
864 
865  /**
866  * \brief Return type (ast::AstNodeType) of ast node as std::string
867  *
868  * Every node in the ast has a type defined in ast::AstNodeType.
869  * This type name can be returned as a std::string for printing
870  * node to text/json form.
871  *
872  * \return name of the node type as a string i.e. "Number"
873  *
874  * \sa Ast::get_node_name
875  */
876  virtual std::string get_node_type_name() const noexcept override {
877  return "Number";
878  }
879 
880  /**
881  * \brief Get std::shared_ptr from `this` pointer of the current ast node
882  */
883  virtual std::shared_ptr<Ast> get_shared_ptr() override {
884  return std::static_pointer_cast<Number>(shared_from_this());
885  }
886 
887  /**
888  * \brief Get std::shared_ptr from `this` pointer of the current ast node
889  */
890  virtual std::shared_ptr<const Ast> get_shared_ptr() const override {
891  return std::static_pointer_cast<const Number>(shared_from_this());
892  }
893 
894  /// \}
895 
896  /// \name Visitor
897  /// \{
898 
899  /**
900  * \brief visit children i.e. member variables of current node using provided
901  * visitor
902  *
903  * Different nodes in the AST have different members (i.e. children). This
904  * method recursively visits children using provided visitor.
905  *
906  * \param v Concrete visitor that will be used to recursively visit children
907  *
908  * \sa Ast::visit_children for example.
909  */
910  virtual void visit_children(visitor::Visitor &v) override;
911 
912  /**
913  * \brief visit children i.e. member variables of current node using provided
914  * visitor
915  *
916  * Different nodes in the AST have different members (i.e. children). This
917  * method recursively visits children using provided visitor.
918  *
919  * \param v Concrete constant visitor that will be used to recursively visit
920  * children
921  *
922  * \sa Ast::visit_children for example.
923  */
924  virtual void visit_children(visitor::ConstVisitor &v) const override;
925 
926  /**
927  * \brief accept (or visit) the current AST node using provided visitor
928  *
929  * Instead of visiting children of AST node, like Ast::visit_children,
930  * accept allows to visit the current node itself using provided concrete
931  * visitor.
932  *
933  * \param v Concrete visitor that will be used to recursively visit node
934  *
935  * \sa Ast::accept for example.
936  */
937  virtual void accept(visitor::Visitor &v) override;
938 
939  /**
940  * \copydoc accept(visitor::Visitor&)
941  */
942  virtual void accept(visitor::ConstVisitor &v) const override;
943 
944  /// \}
945 };
946 
947 /** @} */ // end of ast_class
948 
949 } // namespace ast
950 } // namespace nmodl
951 #endif // !NMODL_AST_NUMBER_HPP
952 #ifndef NMODL_AST_STRING_HPP
953 #define NMODL_AST_STRING_HPP
954 
955 namespace nmodl {
956 namespace ast {
957 
958 /**
959  * @addtogroup ast_class
960  * @ingroup ast
961  * @{
962  */
963 
964 /**
965  * \brief Represents a string
966  *
967  * All statements encapsulating text block are stored in the AST as ast::String.
968  * For example, nodes like ast::LineComment and ast::Verbatim block use
969  * ast::String::value to store the underlying text:
970  *
971  * \code{.mod}
972  * COMMENT
973  * This text is stored as String
974  * ENDCOMMENT
975  *
976  * VERBATIM
977  * int *x;
978  * *x = ...
979  * ENDVERBATIM
980  * \endcode
981  *
982  */
983 class String : public Expression {
984 private:
985  /// Value of string
986  std::string value;
987  /// token with location information
988  std::shared_ptr<ModToken> token;
989 
990 public:
991  /// \name Ctor & dtor
992  /// \{
993 
994  explicit String(const std::string &value);
995  String(const String &obj);
996 
997  String() = default;
998 
999  virtual ~String() = default;
1000 
1001  /// \}
1002 
1003  /**
1004  * \brief Check if the ast node is an instance of ast::String
1005  * \return true as object is of type ast::String
1006  */
1007  bool is_string() const noexcept override { return true; }
1008 
1009  /**
1010  * \brief Return a copy of the current node
1011  *
1012  * Recursively make a new copy/clone of the current node including
1013  * all members and return a pointer to the node. This is used for
1014  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
1015  * ast.
1016  *
1017  * @return pointer to the clone/copy of the current node
1018  */
1019  String *clone() const override { return new String(*this); }
1020 
1021  /// \name Getters
1022  /// \{
1023 
1024  /**
1025  * \brief Return type (ast::AstNodeType) of ast node
1026  *
1027  * Every node in the ast has a type defined in ast::AstNodeType and this
1028  * function is used to retrieve the same.
1029  *
1030  * \return ast node type i.e. ast::AstNodeType::STRING
1031  *
1032  * \sa Ast::get_node_type_name
1033  */
1034  AstNodeType get_node_type() const noexcept override {
1035  return AstNodeType::STRING;
1036  }
1037 
1038  /**
1039  * \brief Return type (ast::AstNodeType) of ast node as std::string
1040  *
1041  * Every node in the ast has a type defined in ast::AstNodeType.
1042  * This type name can be returned as a std::string for printing
1043  * node to text/json form.
1044  *
1045  * \return name of the node type as a string i.e. "String"
1046  *
1047  * \sa Ast::get_node_name
1048  */
1049  std::string get_node_type_name() const noexcept override { return "String"; }
1050 
1051  /**
1052  * \brief Get std::shared_ptr from `this` pointer of the current ast node
1053  */
1054  std::shared_ptr<Ast> get_shared_ptr() override {
1055  return std::static_pointer_cast<String>(shared_from_this());
1056  }
1057 
1058  /**
1059  * \brief Get std::shared_ptr from `this` pointer of the current ast node
1060  */
1061  std::shared_ptr<const Ast> get_shared_ptr() const override {
1062  return std::static_pointer_cast<const String>(shared_from_this());
1063  }
1064 
1065  /**
1066  * \brief Return associated token for the current ast node
1067  *
1068  * Not all ast nodes have token information. For example,
1069  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
1070  * solution of ODEs. In this case, we return nullptr to store in the
1071  * nmodl::symtab::SymbolTable.
1072  *
1073  * \return pointer to token if exist otherwise nullptr
1074  */
1075  const ModToken *get_token() const noexcept override { return token.get(); }
1076 
1077  /**
1078  * \brief Getter for member variable \ref String.value
1079  */
1080  const std::string &get_value() const noexcept { return value; }
1081 
1082  /// \}
1083 
1084  /// \name Setters
1085  /// \{
1086 
1087  /**
1088  * \brief Set token for the current ast node
1089  */
1090  void set_token(const ModToken &tok) {
1091  token = std::make_shared<ModToken>(tok);
1092  }
1093 
1094  /**
1095  * \brief Set new value to the current ast node
1096  * \sa String::eval
1097  */
1098  void set(std::string _value) { value = _value; }
1099 
1100  /**
1101  * \brief Setter for member variable \ref String.value
1102  */
1103  void set_value(std::string value);
1104 
1105  /// \}
1106 
1107  /// \name Visitor
1108  /// \{
1109 
1110  /**
1111  * \brief visit children i.e. member variables of current node using provided
1112  * visitor
1113  *
1114  * Different nodes in the AST have different members (i.e. children). This
1115  * method recursively visits children using provided visitor.
1116  *
1117  * \param v Concrete visitor that will be used to recursively visit children
1118  *
1119  * \sa Ast::visit_children for example.
1120  */
1121  void visit_children(visitor::Visitor &v) override;
1122 
1123  /**
1124  * \brief visit children i.e. member variables of current node using provided
1125  * visitor
1126  *
1127  * Different nodes in the AST have different members (i.e. children). This
1128  * method recursively visits children using provided visitor.
1129  *
1130  * \param v Concrete constant visitor that will be used to recursively visit
1131  * children
1132  *
1133  * \sa Ast::visit_children for example.
1134  */
1135  void visit_children(visitor::ConstVisitor &v) const override;
1136 
1137  /**
1138  * \brief accept (or visit) the current AST node using provided visitor
1139  *
1140  * Instead of visiting children of AST node, like Ast::visit_children,
1141  * accept allows to visit the current node itself using provided concrete
1142  * visitor.
1143  *
1144  * \param v Concrete visitor that will be used to recursively visit node
1145  *
1146  * \sa Ast::accept for example.
1147  */
1148  void accept(visitor::Visitor &v) override;
1149 
1150  /**
1151  * \copydoc accept(visitor::Visitor&)
1152  */
1153  void accept(visitor::ConstVisitor &v) const override;
1154 
1155  /// \}
1156 
1157  /**
1158  * \brief Return value of the ast node
1159  *
1160  * Base data type nodes like ast::Inetegr, ast::Double can be evaluated
1161  * to their literal values. This method is used to access underlying
1162  * literal value.
1163  *
1164  * \sa String::set
1165  */
1166  std::string eval() const { return value; }
1167 
1168 private:
1169  /**
1170  * \brief Set this object as parent for all the children
1171  *
1172  * This should be called in every object (with children) constructor
1173  * to set parents. Since it is called only in the constructors it
1174  * should not be virtual to avoid ambiguities (issue #295).
1175  */
1176  void set_parent_in_children();
1177 };
1178 
1179 /** @} */ // end of ast_class
1180 
1181 } // namespace ast
1182 } // namespace nmodl
1183 #endif // !NMODL_AST_STRING_HPP
1184 #ifndef NMODL_AST_INTEGER_HPP
1185 #define NMODL_AST_INTEGER_HPP
1186 
1187 namespace nmodl {
1188 namespace ast {
1189 
1190 /**
1191  * @addtogroup ast_class
1192  * @ingroup ast
1193  * @{
1194  */
1195 
1196 /**
1197  * \brief Represents an integer variable
1198  *
1199  * Non floating value in the mod file is parsed as an integer. For example,
1200  * in the below code, integer literals like `0` and `11` are stored as
1201  * ast::Integer in the AST :
1202  *
1203  * \code{.mod}
1204  * FROM i=0 TO N {
1205  * tau = X[i] + 11
1206  * }
1207  * \endcode
1208  *
1209  * \sa ast::Float ast::Double
1210  *
1211  */
1212 class Integer : public Number {
1213 private:
1214  /// Value of integer
1215  int value;
1216  /// if integer is a macro then it's name
1217  std::shared_ptr<Name> macro;
1218  /// token with location information
1219  std::shared_ptr<ModToken> token;
1220 
1221 public:
1222  /// \name Ctor & dtor
1223  /// \{
1224 
1225  explicit Integer(int value, Name *macro);
1226  explicit Integer(int value, const std::shared_ptr<Name> &macro);
1227  Integer(const Integer &obj);
1228 
1229  Integer() = default;
1230 
1231  virtual ~Integer() = default;
1232 
1233  /// \}
1234 
1235  /**
1236  * \brief Check if the ast node is an instance of ast::Integer
1237  * \return true as object is of type ast::Integer
1238  */
1239  bool is_integer() const noexcept override { return true; }
1240 
1241  /**
1242  * \brief Return a copy of the current node
1243  *
1244  * Recursively make a new copy/clone of the current node including
1245  * all members and return a pointer to the node. This is used for
1246  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
1247  * ast.
1248  *
1249  * @return pointer to the clone/copy of the current node
1250  */
1251  Integer *clone() const override { return new Integer(*this); }
1252 
1253  /// \name Getters
1254  /// \{
1255 
1256  /**
1257  * \brief Return type (ast::AstNodeType) of ast node
1258  *
1259  * Every node in the ast has a type defined in ast::AstNodeType and this
1260  * function is used to retrieve the same.
1261  *
1262  * \return ast node type i.e. ast::AstNodeType::INTEGER
1263  *
1264  * \sa Ast::get_node_type_name
1265  */
1266  AstNodeType get_node_type() const noexcept override {
1267  return AstNodeType::INTEGER;
1268  }
1269 
1270  /**
1271  * \brief Return type (ast::AstNodeType) of ast node as std::string
1272  *
1273  * Every node in the ast has a type defined in ast::AstNodeType.
1274  * This type name can be returned as a std::string for printing
1275  * node to text/json form.
1276  *
1277  * \return name of the node type as a string i.e. "Integer"
1278  *
1279  * \sa Ast::get_node_name
1280  */
1281  std::string get_node_type_name() const noexcept override { return "Integer"; }
1282 
1283  /**
1284  * \brief Get std::shared_ptr from `this` pointer of the current ast node
1285  */
1286  std::shared_ptr<Ast> get_shared_ptr() override {
1287  return std::static_pointer_cast<Integer>(shared_from_this());
1288  }
1289 
1290  /**
1291  * \brief Get std::shared_ptr from `this` pointer of the current ast node
1292  */
1293  std::shared_ptr<const Ast> get_shared_ptr() const override {
1294  return std::static_pointer_cast<const Integer>(shared_from_this());
1295  }
1296 
1297  /**
1298  * \brief Return associated token for the current ast node
1299  *
1300  * Not all ast nodes have token information. For example,
1301  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
1302  * solution of ODEs. In this case, we return nullptr to store in the
1303  * nmodl::symtab::SymbolTable.
1304  *
1305  * \return pointer to token if exist otherwise nullptr
1306  */
1307  const ModToken *get_token() const noexcept override { return token.get(); }
1308 
1309  /**
1310  * \brief Getter for member variable \ref Integer.value
1311  */
1312  int get_value() const noexcept { return value; }
1313 
1314  /**
1315  * \brief Getter for member variable \ref Integer.macro
1316  */
1317  const std::shared_ptr<Name> &get_macro() const noexcept { return macro; }
1318 
1319  /// \}
1320 
1321  /// \name Setters
1322  /// \{
1323 
1324  /**
1325  * \brief Set token for the current ast node
1326  */
1327  void set_token(const ModToken &tok) {
1328  token = std::make_shared<ModToken>(tok);
1329  }
1330 
1331  /**
1332  * \brief Set new value to the current ast node
1333  * \sa Integer::eval
1334  */
1335  void set(int _value) { value = _value; }
1336 
1337  /**
1338  * \brief Setter for member variable \ref Integer.value
1339  */
1340  void set_value(int value);
1341 
1342  /**
1343  * \brief Setter for member variable \ref Integer.macro (rvalue reference)
1344  */
1345  void set_macro(std::shared_ptr<Name> &&macro);
1346 
1347  /**
1348  * \brief Setter for member variable \ref Integer.macro
1349  */
1350  void set_macro(const std::shared_ptr<Name> &macro);
1351 
1352  /// \}
1353 
1354  /// \name Visitor
1355  /// \{
1356 
1357  /**
1358  * \brief visit children i.e. member variables of current node using provided
1359  * visitor
1360  *
1361  * Different nodes in the AST have different members (i.e. children). This
1362  * method recursively visits children using provided visitor.
1363  *
1364  * \param v Concrete visitor that will be used to recursively visit children
1365  *
1366  * \sa Ast::visit_children for example.
1367  */
1368  void visit_children(visitor::Visitor &v) override;
1369 
1370  /**
1371  * \brief visit children i.e. member variables of current node using provided
1372  * visitor
1373  *
1374  * Different nodes in the AST have different members (i.e. children). This
1375  * method recursively visits children using provided visitor.
1376  *
1377  * \param v Concrete constant visitor that will be used to recursively visit
1378  * children
1379  *
1380  * \sa Ast::visit_children for example.
1381  */
1382  void visit_children(visitor::ConstVisitor &v) const override;
1383 
1384  /**
1385  * \brief accept (or visit) the current AST node using provided visitor
1386  *
1387  * Instead of visiting children of AST node, like Ast::visit_children,
1388  * accept allows to visit the current node itself using provided concrete
1389  * visitor.
1390  *
1391  * \param v Concrete visitor that will be used to recursively visit node
1392  *
1393  * \sa Ast::accept for example.
1394  */
1395  void accept(visitor::Visitor &v) override;
1396 
1397  /**
1398  * \copydoc accept(visitor::Visitor&)
1399  */
1400  void accept(visitor::ConstVisitor &v) const override;
1401 
1402  /// \}
1403 
1404  /**
1405  * \brief Negate the value of current ast node
1406  *
1407  * Parser parse `-x` in two parts : `x` and then `-`. Once second token
1408  * `-` is encountered, the corresponding value of ast node needs to be
1409  * multiplied by `-1` for ast::Number node types.
1410  */
1411  void negate() override { value = -value; }
1412 
1413  /**
1414  * \brief Return value of the current ast node as double
1415  */
1416  double to_double() override { return value; }
1417 
1418  /**
1419  * \brief Return value of the ast node
1420  *
1421  * Base data type nodes like ast::Inetegr, ast::Double can be evaluated
1422  * to their literal values. This method is used to access underlying
1423  * literal value.
1424  *
1425  * \sa Integer::set
1426  */
1427  int eval() const { return value; }
1428 
1429 private:
1430  /**
1431  * \brief Set this object as parent for all the children
1432  *
1433  * This should be called in every object (with children) constructor
1434  * to set parents. Since it is called only in the constructors it
1435  * should not be virtual to avoid ambiguities (issue #295).
1436  */
1437  void set_parent_in_children();
1438 };
1439 
1440 /** @} */ // end of ast_class
1441 
1442 } // namespace ast
1443 } // namespace nmodl
1444 #endif // !NMODL_AST_INTEGER_HPP
1445 #ifndef NMODL_AST_FLOAT_HPP
1446 #define NMODL_AST_FLOAT_HPP
1447 
1448 namespace nmodl {
1449 namespace ast {
1450 
1451 /**
1452  * @addtogroup ast_class
1453  * @ingroup ast
1454  * @{
1455  */
1456 
1457 /**
1458  * \brief Represents a float variable
1459  *
1460  * Single precision float value in the mod file can be represented by
1461  * ast::Float.
1462  *
1463  * \note Currently every float variable in the NMODL is stored as ast::Double
1464  * and hence this type is note used. This will be changed soon for variables
1465  * like ast::ParamAssign.
1466  *
1467  * \sa ast::Integer ast::Double
1468  *
1469  */
1470 class Float : public Number {
1471 private:
1472  /// Value of float
1473  std::string value;
1474  /// token with location information
1475  std::shared_ptr<ModToken> token;
1476 
1477 public:
1478  /// \name Ctor & dtor
1479  /// \{
1480 
1481  explicit Float(const std::string &value);
1482  Float(const Float &obj);
1483 
1484  virtual ~Float() = default;
1485 
1486  /// \}
1487 
1488  /**
1489  * \brief Check if the ast node is an instance of ast::Float
1490  * \return true as object is of type ast::Float
1491  */
1492  bool is_float() const noexcept override { return true; }
1493 
1494  /**
1495  * \brief Return a copy of the current node
1496  *
1497  * Recursively make a new copy/clone of the current node including
1498  * all members and return a pointer to the node. This is used for
1499  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
1500  * ast.
1501  *
1502  * @return pointer to the clone/copy of the current node
1503  */
1504  Float *clone() const override { return new Float(*this); }
1505 
1506  /// \name Getters
1507  /// \{
1508 
1509  /**
1510  * \brief Return type (ast::AstNodeType) of ast node
1511  *
1512  * Every node in the ast has a type defined in ast::AstNodeType and this
1513  * function is used to retrieve the same.
1514  *
1515  * \return ast node type i.e. ast::AstNodeType::FLOAT
1516  *
1517  * \sa Ast::get_node_type_name
1518  */
1519  AstNodeType get_node_type() const noexcept override {
1520  return AstNodeType::FLOAT;
1521  }
1522 
1523  /**
1524  * \brief Return type (ast::AstNodeType) of ast node as std::string
1525  *
1526  * Every node in the ast has a type defined in ast::AstNodeType.
1527  * This type name can be returned as a std::string for printing
1528  * node to text/json form.
1529  *
1530  * \return name of the node type as a string i.e. "Float"
1531  *
1532  * \sa Ast::get_node_name
1533  */
1534  std::string get_node_type_name() const noexcept override { return "Float"; }
1535 
1536  /**
1537  * \brief Get std::shared_ptr from `this` pointer of the current ast node
1538  */
1539  std::shared_ptr<Ast> get_shared_ptr() override {
1540  return std::static_pointer_cast<Float>(shared_from_this());
1541  }
1542 
1543  /**
1544  * \brief Get std::shared_ptr from `this` pointer of the current ast node
1545  */
1546  std::shared_ptr<const Ast> get_shared_ptr() const override {
1547  return std::static_pointer_cast<const Float>(shared_from_this());
1548  }
1549 
1550  /**
1551  * \brief Return associated token for the current ast node
1552  *
1553  * Not all ast nodes have token information. For example,
1554  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
1555  * solution of ODEs. In this case, we return nullptr to store in the
1556  * nmodl::symtab::SymbolTable.
1557  *
1558  * \return pointer to token if exist otherwise nullptr
1559  */
1560  const ModToken *get_token() const noexcept override { return token.get(); }
1561 
1562  /**
1563  * \brief Getter for member variable \ref Float.value
1564  */
1565  const std::string &get_value() const noexcept { return value; }
1566 
1567  /// \}
1568 
1569  /// \name Setters
1570  /// \{
1571 
1572  /**
1573  * \brief Set token for the current ast node
1574  */
1575  void set_token(const ModToken &tok) {
1576  token = std::make_shared<ModToken>(tok);
1577  }
1578 
1579  /**
1580  * \brief Set new value to the current ast node
1581  * \sa Float::eval
1582  */
1583  void set(std::string _value) { value = _value; }
1584 
1585  /**
1586  * \brief Setter for member variable \ref Float.value
1587  */
1588  void set_value(std::string value);
1589 
1590  /// \}
1591 
1592  /// \name Visitor
1593  /// \{
1594 
1595  /**
1596  * \brief visit children i.e. member variables of current node using provided
1597  * visitor
1598  *
1599  * Different nodes in the AST have different members (i.e. children). This
1600  * method recursively visits children using provided visitor.
1601  *
1602  * \param v Concrete visitor that will be used to recursively visit children
1603  *
1604  * \sa Ast::visit_children for example.
1605  */
1606  void visit_children(visitor::Visitor &v) override;
1607 
1608  /**
1609  * \brief visit children i.e. member variables of current node using provided
1610  * visitor
1611  *
1612  * Different nodes in the AST have different members (i.e. children). This
1613  * method recursively visits children using provided visitor.
1614  *
1615  * \param v Concrete constant visitor that will be used to recursively visit
1616  * children
1617  *
1618  * \sa Ast::visit_children for example.
1619  */
1620  void visit_children(visitor::ConstVisitor &v) const override;
1621 
1622  /**
1623  * \brief accept (or visit) the current AST node using provided visitor
1624  *
1625  * Instead of visiting children of AST node, like Ast::visit_children,
1626  * accept allows to visit the current node itself using provided concrete
1627  * visitor.
1628  *
1629  * \param v Concrete visitor that will be used to recursively visit node
1630  *
1631  * \sa Ast::accept for example.
1632  */
1633  void accept(visitor::Visitor &v) override;
1634 
1635  /**
1636  * \copydoc accept(visitor::Visitor&)
1637  */
1638  void accept(visitor::ConstVisitor &v) const override;
1639 
1640  /// \}
1641 
1642  /**
1643  * \brief Negate the value of current ast node
1644  *
1645  * Parser parse `-x` in two parts : `x` and then `-`. Once second token
1646  * `-` is encountered, the corresponding value of ast node needs to be
1647  * multiplied by `-1` for ast::Number node types.
1648  */
1649  void negate() override { value = value.insert(0, 1, '-'); }
1650 
1651  /**
1652  * \brief Return value of the current ast node as double
1653  */
1654  double to_double() override { return std::stod(value); }
1655 
1656  /**
1657  * \brief Return value of the ast node
1658  *
1659  * Base data type nodes like ast::Inetegr, ast::Double can be evaluated
1660  * to their literal values. This method is used to access underlying
1661  * literal value.
1662  *
1663  * \sa Float::set
1664  */
1665  std::string eval() const { return value; }
1666 
1667 private:
1668  /**
1669  * \brief Set this object as parent for all the children
1670  *
1671  * This should be called in every object (with children) constructor
1672  * to set parents. Since it is called only in the constructors it
1673  * should not be virtual to avoid ambiguities (issue #295).
1674  */
1675  void set_parent_in_children();
1676 };
1677 
1678 /** @} */ // end of ast_class
1679 
1680 } // namespace ast
1681 } // namespace nmodl
1682 #endif // !NMODL_AST_FLOAT_HPP
1683 #ifndef NMODL_AST_DOUBLE_HPP
1684 #define NMODL_AST_DOUBLE_HPP
1685 
1686 namespace nmodl {
1687 namespace ast {
1688 
1689 /**
1690  * @addtogroup ast_class
1691  * @ingroup ast
1692  * @{
1693  */
1694 
1695 /**
1696  * \brief Represents a double variable
1697  *
1698  * %Double precision float value in the mod file is represented by ast::Double.
1699  * For example, float literals like `0.1` in the mod file are parsed as double
1700  * and stored using ast::Double::value :
1701  *
1702  * \code{.mod}
1703  * PROCEDURE foo() {
1704  * LOCAL x
1705  * x = 0.1 + tau
1706  * }
1707  * \endcode
1708  *
1709  * Note that the variables are not classified ast integer or float in the AST.
1710  * The decision about variable types is done by code generation backends.
1711  *
1712  * \sa ast::Integer ast::Float
1713  *
1714  */
1715 class Double : public Number {
1716 private:
1717  /// Value of double
1718  std::string value;
1719  /// token with location information
1720  std::shared_ptr<ModToken> token;
1721 
1722 public:
1723  /// \name Ctor & dtor
1724  /// \{
1725 
1726  explicit Double(const std::string &value);
1727  Double(const Double &obj);
1728 
1729  Double() = default;
1730 
1731  virtual ~Double() = default;
1732 
1733  /// \}
1734 
1735  /**
1736  * \brief Check if the ast node is an instance of ast::Double
1737  * \return true as object is of type ast::Double
1738  */
1739  bool is_double() const noexcept override { return true; }
1740 
1741  /**
1742  * \brief Return a copy of the current node
1743  *
1744  * Recursively make a new copy/clone of the current node including
1745  * all members and return a pointer to the node. This is used for
1746  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
1747  * ast.
1748  *
1749  * @return pointer to the clone/copy of the current node
1750  */
1751  Double *clone() const override { return new Double(*this); }
1752 
1753  /// \name Getters
1754  /// \{
1755 
1756  /**
1757  * \brief Return type (ast::AstNodeType) of ast node
1758  *
1759  * Every node in the ast has a type defined in ast::AstNodeType and this
1760  * function is used to retrieve the same.
1761  *
1762  * \return ast node type i.e. ast::AstNodeType::DOUBLE
1763  *
1764  * \sa Ast::get_node_type_name
1765  */
1766  AstNodeType get_node_type() const noexcept override {
1767  return AstNodeType::DOUBLE;
1768  }
1769 
1770  /**
1771  * \brief Return type (ast::AstNodeType) of ast node as std::string
1772  *
1773  * Every node in the ast has a type defined in ast::AstNodeType.
1774  * This type name can be returned as a std::string for printing
1775  * node to text/json form.
1776  *
1777  * \return name of the node type as a string i.e. "Double"
1778  *
1779  * \sa Ast::get_node_name
1780  */
1781  std::string get_node_type_name() const noexcept override { return "Double"; }
1782 
1783  /**
1784  * \brief Get std::shared_ptr from `this` pointer of the current ast node
1785  */
1786  std::shared_ptr<Ast> get_shared_ptr() override {
1787  return std::static_pointer_cast<Double>(shared_from_this());
1788  }
1789 
1790  /**
1791  * \brief Get std::shared_ptr from `this` pointer of the current ast node
1792  */
1793  std::shared_ptr<const Ast> get_shared_ptr() const override {
1794  return std::static_pointer_cast<const Double>(shared_from_this());
1795  }
1796 
1797  /**
1798  * \brief Return associated token for the current ast node
1799  *
1800  * Not all ast nodes have token information. For example,
1801  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
1802  * solution of ODEs. In this case, we return nullptr to store in the
1803  * nmodl::symtab::SymbolTable.
1804  *
1805  * \return pointer to token if exist otherwise nullptr
1806  */
1807  const ModToken *get_token() const noexcept override { return token.get(); }
1808 
1809  /**
1810  * \brief Getter for member variable \ref Double.value
1811  */
1812  const std::string &get_value() const noexcept { return value; }
1813 
1814  /// \}
1815 
1816  /// \name Setters
1817  /// \{
1818 
1819  /**
1820  * \brief Set token for the current ast node
1821  */
1822  void set_token(const ModToken &tok) {
1823  token = std::make_shared<ModToken>(tok);
1824  }
1825 
1826  /**
1827  * \brief Set new value to the current ast node
1828  * \sa Double::eval
1829  */
1830  void set(std::string _value) { value = _value; }
1831 
1832  /**
1833  * \brief Setter for member variable \ref Double.value
1834  */
1835  void set_value(std::string value);
1836 
1837  /// \}
1838 
1839  /// \name Visitor
1840  /// \{
1841 
1842  /**
1843  * \brief visit children i.e. member variables of current node using provided
1844  * visitor
1845  *
1846  * Different nodes in the AST have different members (i.e. children). This
1847  * method recursively visits children using provided visitor.
1848  *
1849  * \param v Concrete visitor that will be used to recursively visit children
1850  *
1851  * \sa Ast::visit_children for example.
1852  */
1853  void visit_children(visitor::Visitor &v) override;
1854 
1855  /**
1856  * \brief visit children i.e. member variables of current node using provided
1857  * visitor
1858  *
1859  * Different nodes in the AST have different members (i.e. children). This
1860  * method recursively visits children using provided visitor.
1861  *
1862  * \param v Concrete constant visitor that will be used to recursively visit
1863  * children
1864  *
1865  * \sa Ast::visit_children for example.
1866  */
1867  void visit_children(visitor::ConstVisitor &v) const override;
1868 
1869  /**
1870  * \brief accept (or visit) the current AST node using provided visitor
1871  *
1872  * Instead of visiting children of AST node, like Ast::visit_children,
1873  * accept allows to visit the current node itself using provided concrete
1874  * visitor.
1875  *
1876  * \param v Concrete visitor that will be used to recursively visit node
1877  *
1878  * \sa Ast::accept for example.
1879  */
1880  void accept(visitor::Visitor &v) override;
1881 
1882  /**
1883  * \copydoc accept(visitor::Visitor&)
1884  */
1885  void accept(visitor::ConstVisitor &v) const override;
1886 
1887  /// \}
1888 
1889  /**
1890  * \brief Negate the value of current ast node
1891  *
1892  * Parser parse `-x` in two parts : `x` and then `-`. Once second token
1893  * `-` is encountered, the corresponding value of ast node needs to be
1894  * multiplied by `-1` for ast::Number node types.
1895  */
1896  void negate() override { value = value.insert(0, 1, '-'); }
1897 
1898  /**
1899  * \brief Return value of the current ast node as double
1900  */
1901  double to_double() override { return std::stod(value); }
1902 
1903  /**
1904  * \brief Return value of the ast node
1905  *
1906  * Base data type nodes like ast::Inetegr, ast::Double can be evaluated
1907  * to their literal values. This method is used to access underlying
1908  * literal value.
1909  *
1910  * \sa Double::set
1911  */
1912  std::string eval() const { return value; }
1913 
1914 private:
1915  /**
1916  * \brief Set this object as parent for all the children
1917  *
1918  * This should be called in every object (with children) constructor
1919  * to set parents. Since it is called only in the constructors it
1920  * should not be virtual to avoid ambiguities (issue #295).
1921  */
1922  void set_parent_in_children();
1923 };
1924 
1925 /** @} */ // end of ast_class
1926 
1927 } // namespace ast
1928 } // namespace nmodl
1929 #endif // !NMODL_AST_DOUBLE_HPP
1930 #ifndef NMODL_AST_BOOLEAN_HPP
1931 #define NMODL_AST_BOOLEAN_HPP
1932 
1933 namespace nmodl {
1934 namespace ast {
1935 
1936 /**
1937  * @addtogroup ast_class
1938  * @ingroup ast
1939  * @{
1940  */
1941 
1942 /**
1943  * \brief Represents a boolean variable
1944  *
1945  * %Boolean values in the mod file can be represented by ast::Boolean.
1946  *
1947  * \note Currently this type is used as only flag in some of the AST nodes.
1948  * Similar to ast::Float, this type was introduced for data type specific code
1949  * generation support in the future.
1950  *
1951  */
1952 class Boolean : public Number {
1953 private:
1954  /// Value of boolean
1955  int value;
1956  /// token with location information
1957  std::shared_ptr<ModToken> token;
1958 
1959 public:
1960  /// \name Ctor & dtor
1961  /// \{
1962 
1963  explicit Boolean(int value);
1964  Boolean(const Boolean &obj);
1965 
1966  virtual ~Boolean() = default;
1967 
1968  /// \}
1969 
1970  /**
1971  * \brief Check if the ast node is an instance of ast::Boolean
1972  * \return true as object is of type ast::Boolean
1973  */
1974  bool is_boolean() const noexcept override { return true; }
1975 
1976  /**
1977  * \brief Return a copy of the current node
1978  *
1979  * Recursively make a new copy/clone of the current node including
1980  * all members and return a pointer to the node. This is used for
1981  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
1982  * ast.
1983  *
1984  * @return pointer to the clone/copy of the current node
1985  */
1986  Boolean *clone() const override { return new Boolean(*this); }
1987 
1988  /// \name Getters
1989  /// \{
1990 
1991  /**
1992  * \brief Return type (ast::AstNodeType) of ast node
1993  *
1994  * Every node in the ast has a type defined in ast::AstNodeType and this
1995  * function is used to retrieve the same.
1996  *
1997  * \return ast node type i.e. ast::AstNodeType::BOOLEAN
1998  *
1999  * \sa Ast::get_node_type_name
2000  */
2001  AstNodeType get_node_type() const noexcept override {
2002  return AstNodeType::BOOLEAN;
2003  }
2004 
2005  /**
2006  * \brief Return type (ast::AstNodeType) of ast node as std::string
2007  *
2008  * Every node in the ast has a type defined in ast::AstNodeType.
2009  * This type name can be returned as a std::string for printing
2010  * node to text/json form.
2011  *
2012  * \return name of the node type as a string i.e. "Boolean"
2013  *
2014  * \sa Ast::get_node_name
2015  */
2016  std::string get_node_type_name() const noexcept override { return "Boolean"; }
2017 
2018  /**
2019  * \brief Get std::shared_ptr from `this` pointer of the current ast node
2020  */
2021  std::shared_ptr<Ast> get_shared_ptr() override {
2022  return std::static_pointer_cast<Boolean>(shared_from_this());
2023  }
2024 
2025  /**
2026  * \brief Get std::shared_ptr from `this` pointer of the current ast node
2027  */
2028  std::shared_ptr<const Ast> get_shared_ptr() const override {
2029  return std::static_pointer_cast<const Boolean>(shared_from_this());
2030  }
2031 
2032  /**
2033  * \brief Return associated token for the current ast node
2034  *
2035  * Not all ast nodes have token information. For example,
2036  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
2037  * solution of ODEs. In this case, we return nullptr to store in the
2038  * nmodl::symtab::SymbolTable.
2039  *
2040  * \return pointer to token if exist otherwise nullptr
2041  */
2042  const ModToken *get_token() const noexcept override { return token.get(); }
2043 
2044  /**
2045  * \brief Getter for member variable \ref Boolean.value
2046  */
2047  int get_value() const noexcept { return value; }
2048 
2049  /// \}
2050 
2051  /// \name Setters
2052  /// \{
2053 
2054  /**
2055  * \brief Set token for the current ast node
2056  */
2057  void set_token(const ModToken &tok) {
2058  token = std::make_shared<ModToken>(tok);
2059  }
2060 
2061  /**
2062  * \brief Set new value to the current ast node
2063  * \sa Boolean::eval
2064  */
2065  void set(bool _value) { value = _value; }
2066 
2067  /**
2068  * \brief Setter for member variable \ref Boolean.value
2069  */
2070  void set_value(int value);
2071 
2072  /// \}
2073 
2074  /// \name Visitor
2075  /// \{
2076 
2077  /**
2078  * \brief visit children i.e. member variables of current node using provided
2079  * visitor
2080  *
2081  * Different nodes in the AST have different members (i.e. children). This
2082  * method recursively visits children using provided visitor.
2083  *
2084  * \param v Concrete visitor that will be used to recursively visit children
2085  *
2086  * \sa Ast::visit_children for example.
2087  */
2088  void visit_children(visitor::Visitor &v) override;
2089 
2090  /**
2091  * \brief visit children i.e. member variables of current node using provided
2092  * visitor
2093  *
2094  * Different nodes in the AST have different members (i.e. children). This
2095  * method recursively visits children using provided visitor.
2096  *
2097  * \param v Concrete constant visitor that will be used to recursively visit
2098  * children
2099  *
2100  * \sa Ast::visit_children for example.
2101  */
2102  void visit_children(visitor::ConstVisitor &v) const override;
2103 
2104  /**
2105  * \brief accept (or visit) the current AST node using provided visitor
2106  *
2107  * Instead of visiting children of AST node, like Ast::visit_children,
2108  * accept allows to visit the current node itself using provided concrete
2109  * visitor.
2110  *
2111  * \param v Concrete visitor that will be used to recursively visit node
2112  *
2113  * \sa Ast::accept for example.
2114  */
2115  void accept(visitor::Visitor &v) override;
2116 
2117  /**
2118  * \copydoc accept(visitor::Visitor&)
2119  */
2120  void accept(visitor::ConstVisitor &v) const override;
2121 
2122  /// \}
2123 
2124  /**
2125  * \brief Negate the value of current ast node
2126  *
2127  * Parser parse `-x` in two parts : `x` and then `-`. Once second token
2128  * `-` is encountered, the corresponding value of ast node needs to be
2129  * multiplied by `-1` for ast::Number node types.
2130  */
2131  void negate() override { value = !value; }
2132 
2133  /**
2134  * \brief Return value of the current ast node as double
2135  */
2136  double to_double() override { return value; }
2137 
2138  /**
2139  * \brief Return value of the ast node
2140  *
2141  * Base data type nodes like ast::Inetegr, ast::Double can be evaluated
2142  * to their literal values. This method is used to access underlying
2143  * literal value.
2144  *
2145  * \sa Boolean::set
2146  */
2147  bool eval() const { return value; }
2148 
2149 private:
2150  /**
2151  * \brief Set this object as parent for all the children
2152  *
2153  * This should be called in every object (with children) constructor
2154  * to set parents. Since it is called only in the constructors it
2155  * should not be virtual to avoid ambiguities (issue #295).
2156  */
2157  void set_parent_in_children();
2158 };
2159 
2160 /** @} */ // end of ast_class
2161 
2162 } // namespace ast
2163 } // namespace nmodl
2164 #endif // !NMODL_AST_BOOLEAN_HPP
2165 #ifndef NMODL_AST_NAME_HPP
2166 #define NMODL_AST_NAME_HPP
2167 
2168 namespace nmodl {
2169 namespace ast {
2170 
2171 /**
2172  * @addtogroup ast_class
2173  * @ingroup ast
2174  * @{
2175  */
2176 
2177 /**
2178  * \brief Represents a name
2179  *
2180  * Whenever lexer encounters string variable, it returns a ast::Name
2181  * type. So, along with ast::Integer, ast::Double ast::String and
2182  * ast::PrimeName, ast::Name is one of the fundamental type in the AST. Many
2183  * other variable types (e.g. ast::GlobalVar, ast::RangeVar) have underlying
2184  * value stored as ast::Name.
2185  *
2186  * \note This node should be able to use std::string as value type instead of
2187  * ast::String
2188  *
2189  */
2190 class Name : public Identifier {
2191 private:
2192  /// Value of name
2193  std::shared_ptr<String> value;
2194  /// token with location information
2195  std::shared_ptr<ModToken> token;
2196 
2197 public:
2198  /// \name Ctor & dtor
2199  /// \{
2200 
2201  explicit Name(String *value);
2202  explicit Name(const std::shared_ptr<String> &value);
2203  Name(const Name &obj);
2204 
2205  Name() = default;
2206 
2207  virtual ~Name() = default;
2208 
2209  /// \}
2210 
2211  /**
2212  * \brief Check if the ast node is an instance of ast::Name
2213  * \return true as object is of type ast::Name
2214  */
2215  bool is_name() const noexcept override { return true; }
2216 
2217  /**
2218  * \brief Return a copy of the current node
2219  *
2220  * Recursively make a new copy/clone of the current node including
2221  * all members and return a pointer to the node. This is used for
2222  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
2223  * ast.
2224  *
2225  * @return pointer to the clone/copy of the current node
2226  */
2227  Name *clone() const override { return new Name(*this); }
2228 
2229  /// \name Getters
2230  /// \{
2231 
2232  /**
2233  * \brief Return type (ast::AstNodeType) of ast node
2234  *
2235  * Every node in the ast has a type defined in ast::AstNodeType and this
2236  * function is used to retrieve the same.
2237  *
2238  * \return ast node type i.e. ast::AstNodeType::NAME
2239  *
2240  * \sa Ast::get_node_type_name
2241  */
2242  AstNodeType get_node_type() const noexcept override {
2243  return AstNodeType::NAME;
2244  }
2245 
2246  /**
2247  * \brief Return type (ast::AstNodeType) of ast node as std::string
2248  *
2249  * Every node in the ast has a type defined in ast::AstNodeType.
2250  * This type name can be returned as a std::string for printing
2251  * node to text/json form.
2252  *
2253  * \return name of the node type as a string i.e. "Name"
2254  *
2255  * \sa Ast::get_node_name
2256  */
2257  std::string get_node_type_name() const noexcept override { return "Name"; }
2258 
2259  /**
2260  * \brief Get std::shared_ptr from `this` pointer of the current ast node
2261  */
2262  std::shared_ptr<Ast> get_shared_ptr() override {
2263  return std::static_pointer_cast<Name>(shared_from_this());
2264  }
2265 
2266  /**
2267  * \brief Get std::shared_ptr from `this` pointer of the current ast node
2268  */
2269  std::shared_ptr<const Ast> get_shared_ptr() const override {
2270  return std::static_pointer_cast<const Name>(shared_from_this());
2271  }
2272 
2273  /**
2274  * \brief Return associated token for the current ast node
2275  *
2276  * Not all ast nodes have token information. For example,
2277  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
2278  * solution of ODEs. In this case, we return nullptr to store in the
2279  * nmodl::symtab::SymbolTable.
2280  *
2281  * \return pointer to token if exist otherwise nullptr
2282  */
2283  const ModToken *get_token() const noexcept override { return token.get(); }
2284 
2285  /**
2286  * \brief Return name of the node
2287  *
2288  * Some ast nodes have a member marked designated as node name. For example,
2289  * in case of this ast::String has value designated as a
2290  * node name.
2291  *
2292  * @return name of the node as std::string
2293  *
2294  * \sa Ast::get_node_type_name
2295  */
2296  std::string get_node_name() const override;
2297 
2298  /**
2299  * \brief Getter for member variable \ref Name.value
2300  */
2301  const std::shared_ptr<String> &get_value() const noexcept { return value; }
2302 
2303  /// \}
2304 
2305  /// \name Setters
2306  /// \{
2307 
2308  /**
2309  * \brief Set name for the current ast node
2310  *
2311  * Some ast nodes have a member marked designated as node name (e.g. nodes
2312  * derived from ast::Identifier). This method is used to set new name for
2313  * those nodes. This useful for passes like nmodl::visitor::RenameVisitor.
2314  *
2315  * \sa Ast::get_node_type_name Ast::get_node_name
2316  */
2317  void set_name(const std::string &name) override;
2318 
2319  /**
2320  * \brief Set token for the current ast node
2321  */
2322  void set_token(const ModToken &tok) {
2323  token = std::make_shared<ModToken>(tok);
2324  }
2325 
2326  /**
2327  * \brief Setter for member variable \ref Name.value (rvalue reference)
2328  */
2329  void set_value(std::shared_ptr<String> &&value);
2330 
2331  /**
2332  * \brief Setter for member variable \ref Name.value
2333  */
2334  void set_value(const std::shared_ptr<String> &value);
2335 
2336  /// \}
2337 
2338  /// \name Visitor
2339  /// \{
2340 
2341  /**
2342  * \brief visit children i.e. member variables of current node using provided
2343  * visitor
2344  *
2345  * Different nodes in the AST have different members (i.e. children). This
2346  * method recursively visits children using provided visitor.
2347  *
2348  * \param v Concrete visitor that will be used to recursively visit children
2349  *
2350  * \sa Ast::visit_children for example.
2351  */
2352  void visit_children(visitor::Visitor &v) override;
2353 
2354  /**
2355  * \brief visit children i.e. member variables of current node using provided
2356  * visitor
2357  *
2358  * Different nodes in the AST have different members (i.e. children). This
2359  * method recursively visits children using provided visitor.
2360  *
2361  * \param v Concrete constant visitor that will be used to recursively visit
2362  * children
2363  *
2364  * \sa Ast::visit_children for example.
2365  */
2366  void visit_children(visitor::ConstVisitor &v) const override;
2367 
2368  /**
2369  * \brief accept (or visit) the current AST node using provided visitor
2370  *
2371  * Instead of visiting children of AST node, like Ast::visit_children,
2372  * accept allows to visit the current node itself using provided concrete
2373  * visitor.
2374  *
2375  * \param v Concrete visitor that will be used to recursively visit node
2376  *
2377  * \sa Ast::accept for example.
2378  */
2379  void accept(visitor::Visitor &v) override;
2380 
2381  /**
2382  * \copydoc accept(visitor::Visitor&)
2383  */
2384  void accept(visitor::ConstVisitor &v) const override;
2385 
2386  /// \}
2387 
2388 private:
2389  /**
2390  * \brief Set this object as parent for all the children
2391  *
2392  * This should be called in every object (with children) constructor
2393  * to set parents. Since it is called only in the constructors it
2394  * should not be virtual to avoid ambiguities (issue #295).
2395  */
2396  void set_parent_in_children();
2397 };
2398 
2399 /** @} */ // end of ast_class
2400 
2401 } // namespace ast
2402 } // namespace nmodl
2403 #endif // !NMODL_AST_NAME_HPP
2404 #ifndef NMODL_AST_PRIME_NAME_HPP
2405 #define NMODL_AST_PRIME_NAME_HPP
2406 
2407 namespace nmodl {
2408 namespace ast {
2409 
2410 /**
2411  * @addtogroup ast_class
2412  * @ingroup ast
2413  * @{
2414  */
2415 
2416 /**
2417  * \brief Represents a prime variable (for ODE)
2418  *
2419  * In case of ODE specification, all state variables appearing on LHS
2420  * with \` as suffix are parsed by lexer as ast::PrimeName. For example,
2421  * in below NMODL construct, m\` is stored as ast::PrimeName with `m` as a
2422  * ast::PrimeName::value and `1` as an ast::PrimeName::order.
2423  *
2424  * \code
2425  * DERIVATIVE states {
2426  * m` = m + h
2427  * }
2428  * \endcode
2429  *
2430  */
2431 class PrimeName : public Identifier {
2432 private:
2433  /// Name of prime variable
2434  std::shared_ptr<String> value;
2435  /// order of ODE
2436  std::shared_ptr<Integer> order;
2437  /// token with location information
2438  std::shared_ptr<ModToken> token;
2439 
2440 public:
2441  /// \name Ctor & dtor
2442  /// \{
2443 
2444  explicit PrimeName(String *value, Integer *order);
2445  explicit PrimeName(const std::shared_ptr<String> &value,
2446  const std::shared_ptr<Integer> &order);
2447  PrimeName(const PrimeName &obj);
2448 
2449  PrimeName() = default;
2450 
2451  virtual ~PrimeName() = default;
2452 
2453  /// \}
2454 
2455  /**
2456  * \brief Check if the ast node is an instance of ast::PrimeName
2457  * \return true as object is of type ast::PrimeName
2458  */
2459  bool is_prime_name() const noexcept override { return true; }
2460 
2461  /**
2462  * \brief Return a copy of the current node
2463  *
2464  * Recursively make a new copy/clone of the current node including
2465  * all members and return a pointer to the node. This is used for
2466  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
2467  * ast.
2468  *
2469  * @return pointer to the clone/copy of the current node
2470  */
2471  PrimeName *clone() const override { return new PrimeName(*this); }
2472 
2473  /// \name Getters
2474  /// \{
2475 
2476  /**
2477  * \brief Return type (ast::AstNodeType) of ast node
2478  *
2479  * Every node in the ast has a type defined in ast::AstNodeType and this
2480  * function is used to retrieve the same.
2481  *
2482  * \return ast node type i.e. ast::AstNodeType::PRIME_NAME
2483  *
2484  * \sa Ast::get_node_type_name
2485  */
2486  AstNodeType get_node_type() const noexcept override {
2487  return AstNodeType::PRIME_NAME;
2488  }
2489 
2490  /**
2491  * \brief Return type (ast::AstNodeType) of ast node as std::string
2492  *
2493  * Every node in the ast has a type defined in ast::AstNodeType.
2494  * This type name can be returned as a std::string for printing
2495  * node to text/json form.
2496  *
2497  * \return name of the node type as a string i.e. "PrimeName"
2498  *
2499  * \sa Ast::get_node_name
2500  */
2501  std::string get_node_type_name() const noexcept override {
2502  return "PrimeName";
2503  }
2504 
2505  /**
2506  * \brief Get std::shared_ptr from `this` pointer of the current ast node
2507  */
2508  std::shared_ptr<Ast> get_shared_ptr() override {
2509  return std::static_pointer_cast<PrimeName>(shared_from_this());
2510  }
2511 
2512  /**
2513  * \brief Get std::shared_ptr from `this` pointer of the current ast node
2514  */
2515  std::shared_ptr<const Ast> get_shared_ptr() const override {
2516  return std::static_pointer_cast<const PrimeName>(shared_from_this());
2517  }
2518 
2519  /**
2520  * \brief Return associated token for the current ast node
2521  *
2522  * Not all ast nodes have token information. For example,
2523  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
2524  * solution of ODEs. In this case, we return nullptr to store in the
2525  * nmodl::symtab::SymbolTable.
2526  *
2527  * \return pointer to token if exist otherwise nullptr
2528  */
2529  const ModToken *get_token() const noexcept override { return token.get(); }
2530 
2531  /**
2532  * \brief Return name of the node
2533  *
2534  * Some ast nodes have a member marked designated as node name. For example,
2535  * in case of this ast::String has value designated as a
2536  * node name.
2537  *
2538  * @return name of the node as std::string
2539  *
2540  * \sa Ast::get_node_type_name
2541  */
2542  std::string get_node_name() const override;
2543 
2544  /**
2545  * \brief Getter for member variable \ref PrimeName.value
2546  */
2547  const std::shared_ptr<String> &get_value() const noexcept { return value; }
2548 
2549  /**
2550  * \brief Getter for member variable \ref PrimeName.order
2551  */
2552  const std::shared_ptr<Integer> &get_order() const noexcept { return order; }
2553 
2554  /// \}
2555 
2556  /// \name Setters
2557  /// \{
2558 
2559  /**
2560  * \brief Set token for the current ast node
2561  */
2562  void set_token(const ModToken &tok) {
2563  token = std::make_shared<ModToken>(tok);
2564  }
2565 
2566  /**
2567  * \brief Setter for member variable \ref PrimeName.value (rvalue reference)
2568  */
2569  void set_value(std::shared_ptr<String> &&value);
2570 
2571  /**
2572  * \brief Setter for member variable \ref PrimeName.value
2573  */
2574  void set_value(const std::shared_ptr<String> &value);
2575 
2576  /**
2577  * \brief Setter for member variable \ref PrimeName.order (rvalue reference)
2578  */
2579  void set_order(std::shared_ptr<Integer> &&order);
2580 
2581  /**
2582  * \brief Setter for member variable \ref PrimeName.order
2583  */
2584  void set_order(const std::shared_ptr<Integer> &order);
2585 
2586  /// \}
2587 
2588  /// \name Visitor
2589  /// \{
2590 
2591  /**
2592  * \brief visit children i.e. member variables of current node using provided
2593  * visitor
2594  *
2595  * Different nodes in the AST have different members (i.e. children). This
2596  * method recursively visits children using provided visitor.
2597  *
2598  * \param v Concrete visitor that will be used to recursively visit children
2599  *
2600  * \sa Ast::visit_children for example.
2601  */
2602  void visit_children(visitor::Visitor &v) override;
2603 
2604  /**
2605  * \brief visit children i.e. member variables of current node using provided
2606  * visitor
2607  *
2608  * Different nodes in the AST have different members (i.e. children). This
2609  * method recursively visits children using provided visitor.
2610  *
2611  * \param v Concrete constant visitor that will be used to recursively visit
2612  * children
2613  *
2614  * \sa Ast::visit_children for example.
2615  */
2616  void visit_children(visitor::ConstVisitor &v) const override;
2617 
2618  /**
2619  * \brief accept (or visit) the current AST node using provided visitor
2620  *
2621  * Instead of visiting children of AST node, like Ast::visit_children,
2622  * accept allows to visit the current node itself using provided concrete
2623  * visitor.
2624  *
2625  * \param v Concrete visitor that will be used to recursively visit node
2626  *
2627  * \sa Ast::accept for example.
2628  */
2629  void accept(visitor::Visitor &v) override;
2630 
2631  /**
2632  * \copydoc accept(visitor::Visitor&)
2633  */
2634  void accept(visitor::ConstVisitor &v) const override;
2635 
2636  /// \}
2637 
2638 private:
2639  /**
2640  * \brief Set this object as parent for all the children
2641  *
2642  * This should be called in every object (with children) constructor
2643  * to set parents. Since it is called only in the constructors it
2644  * should not be virtual to avoid ambiguities (issue #295).
2645  */
2646  void set_parent_in_children();
2647 };
2648 
2649 /** @} */ // end of ast_class
2650 
2651 } // namespace ast
2652 } // namespace nmodl
2653 #endif // !NMODL_AST_PRIME_NAME_HPP
2654 #ifndef NMODL_AST_INDEXED_NAME_HPP
2655 #define NMODL_AST_INDEXED_NAME_HPP
2656 
2657 namespace nmodl {
2658 namespace ast {
2659 
2660 /**
2661  * @addtogroup ast_class
2662  * @ingroup ast
2663  * @{
2664  */
2665 
2666 /**
2667  * \brief Represents specific element of an array variable
2668  *
2669  * If variable is declared as an array or when array element is accessed,
2670  * it is stored in the ast as ast::IndexedName. For example, in below NMODL,
2671  * construct `m[4]` is stored as ast::IndexedName with `m` as
2672  * ast::IndexedName::name and `4` as ast::IndexedName::legth.
2673  *
2674  * \code
2675  * STATE {
2676  * m[4]
2677  * }
2678  * \endcode
2679  *
2680  */
2681 class IndexedName : public Identifier {
2682 private:
2683  /// Name of array variable
2684  std::shared_ptr<Identifier> name;
2685  /// legth of an array or index position
2686  std::shared_ptr<Expression> length;
2687  /// token with location information
2688  std::shared_ptr<ModToken> token;
2689 
2690 public:
2691  /// \name Ctor & dtor
2692  /// \{
2693 
2694  explicit IndexedName(Identifier *name, Expression *length);
2695  explicit IndexedName(const std::shared_ptr<Identifier> &name,
2696  const std::shared_ptr<Expression> &length);
2697  IndexedName(const IndexedName &obj);
2698 
2699  virtual ~IndexedName() = default;
2700 
2701  /// \}
2702 
2703  /**
2704  * \brief Check if the ast node is an instance of ast::IndexedName
2705  * \return true as object is of type ast::IndexedName
2706  */
2707  bool is_indexed_name() const noexcept override { return true; }
2708 
2709  /**
2710  * \brief Return a copy of the current node
2711  *
2712  * Recursively make a new copy/clone of the current node including
2713  * all members and return a pointer to the node. This is used for
2714  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
2715  * ast.
2716  *
2717  * @return pointer to the clone/copy of the current node
2718  */
2719  IndexedName *clone() const override { return new IndexedName(*this); }
2720 
2721  /// \name Getters
2722  /// \{
2723 
2724  /**
2725  * \brief Return type (ast::AstNodeType) of ast node
2726  *
2727  * Every node in the ast has a type defined in ast::AstNodeType and this
2728  * function is used to retrieve the same.
2729  *
2730  * \return ast node type i.e. ast::AstNodeType::INDEXED_NAME
2731  *
2732  * \sa Ast::get_node_type_name
2733  */
2734  AstNodeType get_node_type() const noexcept override {
2736  }
2737 
2738  /**
2739  * \brief Return type (ast::AstNodeType) of ast node as std::string
2740  *
2741  * Every node in the ast has a type defined in ast::AstNodeType.
2742  * This type name can be returned as a std::string for printing
2743  * node to text/json form.
2744  *
2745  * \return name of the node type as a string i.e. "IndexedName"
2746  *
2747  * \sa Ast::get_node_name
2748  */
2749  std::string get_node_type_name() const noexcept override {
2750  return "IndexedName";
2751  }
2752 
2753  /**
2754  * \brief Get std::shared_ptr from `this` pointer of the current ast node
2755  */
2756  std::shared_ptr<Ast> get_shared_ptr() override {
2757  return std::static_pointer_cast<IndexedName>(shared_from_this());
2758  }
2759 
2760  /**
2761  * \brief Get std::shared_ptr from `this` pointer of the current ast node
2762  */
2763  std::shared_ptr<const Ast> get_shared_ptr() const override {
2764  return std::static_pointer_cast<const IndexedName>(shared_from_this());
2765  }
2766 
2767  /**
2768  * \brief Return associated token for the current ast node
2769  *
2770  * Not all ast nodes have token information. For example,
2771  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
2772  * solution of ODEs. In this case, we return nullptr to store in the
2773  * nmodl::symtab::SymbolTable.
2774  *
2775  * \return pointer to token if exist otherwise nullptr
2776  */
2777  const ModToken *get_token() const noexcept override { return token.get(); }
2778 
2779  /**
2780  * \brief Return name of the node
2781  *
2782  * Some ast nodes have a member marked designated as node name. For example,
2783  * in case of this ast::Identifier has name designated as a
2784  * node name.
2785  *
2786  * @return name of the node as std::string
2787  *
2788  * \sa Ast::get_node_type_name
2789  */
2790  std::string get_node_name() const override;
2791 
2792  /**
2793  * \brief Getter for member variable \ref IndexedName.name
2794  */
2795  const std::shared_ptr<Identifier> &get_name() const noexcept { return name; }
2796 
2797  /**
2798  * \brief Getter for member variable \ref IndexedName.length
2799  */
2800  const std::shared_ptr<Expression> &get_length() const noexcept {
2801  return length;
2802  }
2803 
2804  /// \}
2805 
2806  /// \name Setters
2807  /// \{
2808 
2809  /**
2810  * \brief Set token for the current ast node
2811  */
2812  void set_token(const ModToken &tok) {
2813  token = std::make_shared<ModToken>(tok);
2814  }
2815 
2816  /**
2817  * \brief Setter for member variable \ref IndexedName.name (rvalue reference)
2818  */
2819  void set_name(std::shared_ptr<Identifier> &&name);
2820 
2821  /**
2822  * \brief Setter for member variable \ref IndexedName.name
2823  */
2824  void set_name(const std::shared_ptr<Identifier> &name);
2825 
2826  /**
2827  * \brief Setter for member variable \ref IndexedName.length (rvalue
2828  * reference)
2829  */
2830  void set_length(std::shared_ptr<Expression> &&length);
2831 
2832  /**
2833  * \brief Setter for member variable \ref IndexedName.length
2834  */
2835  void set_length(const std::shared_ptr<Expression> &length);
2836 
2837  /// \}
2838 
2839  /// \name Visitor
2840  /// \{
2841 
2842  /**
2843  * \brief visit children i.e. member variables of current node using provided
2844  * visitor
2845  *
2846  * Different nodes in the AST have different members (i.e. children). This
2847  * method recursively visits children using provided visitor.
2848  *
2849  * \param v Concrete visitor that will be used to recursively visit children
2850  *
2851  * \sa Ast::visit_children for example.
2852  */
2853  void visit_children(visitor::Visitor &v) override;
2854 
2855  /**
2856  * \brief visit children i.e. member variables of current node using provided
2857  * visitor
2858  *
2859  * Different nodes in the AST have different members (i.e. children). This
2860  * method recursively visits children using provided visitor.
2861  *
2862  * \param v Concrete constant visitor that will be used to recursively visit
2863  * children
2864  *
2865  * \sa Ast::visit_children for example.
2866  */
2867  void visit_children(visitor::ConstVisitor &v) const override;
2868 
2869  /**
2870  * \brief accept (or visit) the current AST node using provided visitor
2871  *
2872  * Instead of visiting children of AST node, like Ast::visit_children,
2873  * accept allows to visit the current node itself using provided concrete
2874  * visitor.
2875  *
2876  * \param v Concrete visitor that will be used to recursively visit node
2877  *
2878  * \sa Ast::accept for example.
2879  */
2880  void accept(visitor::Visitor &v) override;
2881 
2882  /**
2883  * \copydoc accept(visitor::Visitor&)
2884  */
2885  void accept(visitor::ConstVisitor &v) const override;
2886 
2887  /// \}
2888 
2889 private:
2890  /**
2891  * \brief Set this object as parent for all the children
2892  *
2893  * This should be called in every object (with children) constructor
2894  * to set parents. Since it is called only in the constructors it
2895  * should not be virtual to avoid ambiguities (issue #295).
2896  */
2897  void set_parent_in_children();
2898 };
2899 
2900 /** @} */ // end of ast_class
2901 
2902 } // namespace ast
2903 } // namespace nmodl
2904 #endif // !NMODL_AST_INDEXED_NAME_HPP
2905 #ifndef NMODL_AST_VAR_NAME_HPP
2906 #define NMODL_AST_VAR_NAME_HPP
2907 
2908 namespace nmodl {
2909 namespace ast {
2910 
2911 /**
2912  * @addtogroup ast_class
2913  * @ingroup ast
2914  * @{
2915  */
2916 
2917 /**
2918  * \brief Represents a variable
2919  *
2920  * This type was introduced to store variables of different types like
2921  * ast::Name or ast::IndexedName in the AST.
2922  *
2923  * \note With ast::Identifier as top level base class, this type can be
2924  * removed in the future refactoring.
2925  *
2926  */
2927 class VarName : public Identifier {
2928 private:
2929  /// Name of variable
2930  std::shared_ptr<Identifier> name;
2931  /// Value specified with `@`
2932  std::shared_ptr<Integer> at;
2933  /// index value in case of array
2934  std::shared_ptr<Expression> index;
2935  /// token with location information
2936  std::shared_ptr<ModToken> token;
2937 
2938 public:
2939  /// \name Ctor & dtor
2940  /// \{
2941 
2942  explicit VarName(Identifier *name, Integer *at, Expression *index);
2943  explicit VarName(const std::shared_ptr<Identifier> &name,
2944  const std::shared_ptr<Integer> &at,
2945  const std::shared_ptr<Expression> &index);
2946  VarName(const VarName &obj);
2947 
2948  virtual ~VarName() = default;
2949 
2950  /// \}
2951 
2952  /**
2953  * \brief Check if the ast node is an instance of ast::VarName
2954  * \return true as object is of type ast::VarName
2955  */
2956  bool is_var_name() const noexcept override { return true; }
2957 
2958  /**
2959  * \brief Return a copy of the current node
2960  *
2961  * Recursively make a new copy/clone of the current node including
2962  * all members and return a pointer to the node. This is used for
2963  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
2964  * ast.
2965  *
2966  * @return pointer to the clone/copy of the current node
2967  */
2968  VarName *clone() const override { return new VarName(*this); }
2969 
2970  /// \name Getters
2971  /// \{
2972 
2973  /**
2974  * \brief Return type (ast::AstNodeType) of ast node
2975  *
2976  * Every node in the ast has a type defined in ast::AstNodeType and this
2977  * function is used to retrieve the same.
2978  *
2979  * \return ast node type i.e. ast::AstNodeType::VAR_NAME
2980  *
2981  * \sa Ast::get_node_type_name
2982  */
2983  AstNodeType get_node_type() const noexcept override {
2984  return AstNodeType::VAR_NAME;
2985  }
2986 
2987  /**
2988  * \brief Return type (ast::AstNodeType) of ast node as std::string
2989  *
2990  * Every node in the ast has a type defined in ast::AstNodeType.
2991  * This type name can be returned as a std::string for printing
2992  * node to text/json form.
2993  *
2994  * \return name of the node type as a string i.e. "VarName"
2995  *
2996  * \sa Ast::get_node_name
2997  */
2998  std::string get_node_type_name() const noexcept override { return "VarName"; }
2999 
3000  /**
3001  * \brief Get std::shared_ptr from `this` pointer of the current ast node
3002  */
3003  std::shared_ptr<Ast> get_shared_ptr() override {
3004  return std::static_pointer_cast<VarName>(shared_from_this());
3005  }
3006 
3007  /**
3008  * \brief Get std::shared_ptr from `this` pointer of the current ast node
3009  */
3010  std::shared_ptr<const Ast> get_shared_ptr() const override {
3011  return std::static_pointer_cast<const VarName>(shared_from_this());
3012  }
3013 
3014  /**
3015  * \brief Return associated token for the current ast node
3016  *
3017  * Not all ast nodes have token information. For example,
3018  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
3019  * solution of ODEs. In this case, we return nullptr to store in the
3020  * nmodl::symtab::SymbolTable.
3021  *
3022  * \return pointer to token if exist otherwise nullptr
3023  */
3024  const ModToken *get_token() const noexcept override { return token.get(); }
3025 
3026  /**
3027  * \brief Return name of the node
3028  *
3029  * Some ast nodes have a member marked designated as node name. For example,
3030  * in case of this ast::Identifier has name designated as a
3031  * node name.
3032  *
3033  * @return name of the node as std::string
3034  *
3035  * \sa Ast::get_node_type_name
3036  */
3037  std::string get_node_name() const override;
3038 
3039  /**
3040  * \brief Getter for member variable \ref VarName.name
3041  */
3042  const std::shared_ptr<Identifier> &get_name() const noexcept { return name; }
3043 
3044  /**
3045  * \brief Getter for member variable \ref VarName.at
3046  */
3047  const std::shared_ptr<Integer> &get_at() const noexcept { return at; }
3048 
3049  /**
3050  * \brief Getter for member variable \ref VarName.index
3051  */
3052  const std::shared_ptr<Expression> &get_index() const noexcept {
3053  return index;
3054  }
3055 
3056  /// \}
3057 
3058  /// \name Setters
3059  /// \{
3060 
3061  /**
3062  * \brief Set token for the current ast node
3063  */
3064  void set_token(const ModToken &tok) {
3065  token = std::make_shared<ModToken>(tok);
3066  }
3067 
3068  /**
3069  * \brief Setter for member variable \ref VarName.name (rvalue reference)
3070  */
3071  void set_name(std::shared_ptr<Identifier> &&name);
3072 
3073  /**
3074  * \brief Setter for member variable \ref VarName.name
3075  */
3076  void set_name(const std::shared_ptr<Identifier> &name);
3077 
3078  /**
3079  * \brief Setter for member variable \ref VarName.at (rvalue reference)
3080  */
3081  void set_at(std::shared_ptr<Integer> &&at);
3082 
3083  /**
3084  * \brief Setter for member variable \ref VarName.at
3085  */
3086  void set_at(const std::shared_ptr<Integer> &at);
3087 
3088  /**
3089  * \brief Setter for member variable \ref VarName.index (rvalue reference)
3090  */
3091  void set_index(std::shared_ptr<Expression> &&index);
3092 
3093  /**
3094  * \brief Setter for member variable \ref VarName.index
3095  */
3096  void set_index(const std::shared_ptr<Expression> &index);
3097 
3098  /// \}
3099 
3100  /// \name Visitor
3101  /// \{
3102 
3103  /**
3104  * \brief visit children i.e. member variables of current node using provided
3105  * visitor
3106  *
3107  * Different nodes in the AST have different members (i.e. children). This
3108  * method recursively visits children using provided visitor.
3109  *
3110  * \param v Concrete visitor that will be used to recursively visit children
3111  *
3112  * \sa Ast::visit_children for example.
3113  */
3114  void visit_children(visitor::Visitor &v) override;
3115 
3116  /**
3117  * \brief visit children i.e. member variables of current node using provided
3118  * visitor
3119  *
3120  * Different nodes in the AST have different members (i.e. children). This
3121  * method recursively visits children using provided visitor.
3122  *
3123  * \param v Concrete constant visitor that will be used to recursively visit
3124  * children
3125  *
3126  * \sa Ast::visit_children for example.
3127  */
3128  void visit_children(visitor::ConstVisitor &v) const override;
3129 
3130  /**
3131  * \brief accept (or visit) the current AST node using provided visitor
3132  *
3133  * Instead of visiting children of AST node, like Ast::visit_children,
3134  * accept allows to visit the current node itself using provided concrete
3135  * visitor.
3136  *
3137  * \param v Concrete visitor that will be used to recursively visit node
3138  *
3139  * \sa Ast::accept for example.
3140  */
3141  void accept(visitor::Visitor &v) override;
3142 
3143  /**
3144  * \copydoc accept(visitor::Visitor&)
3145  */
3146  void accept(visitor::ConstVisitor &v) const override;
3147 
3148  /// \}
3149 
3150 private:
3151  /**
3152  * \brief Set this object as parent for all the children
3153  *
3154  * This should be called in every object (with children) constructor
3155  * to set parents. Since it is called only in the constructors it
3156  * should not be virtual to avoid ambiguities (issue #295).
3157  */
3158  void set_parent_in_children();
3159 };
3160 
3161 /** @} */ // end of ast_class
3162 
3163 } // namespace ast
3164 } // namespace nmodl
3165 #endif // !NMODL_AST_VAR_NAME_HPP
3166 #ifndef NMODL_AST_ARGUMENT_HPP
3167 #define NMODL_AST_ARGUMENT_HPP
3168 
3169 namespace nmodl {
3170 namespace ast {
3171 
3172 /**
3173  * @addtogroup ast_class
3174  * @ingroup ast
3175  * @{
3176  */
3177 
3178 /**
3179  * \brief Represents an argument to functions and procedures
3180  *
3181  * In case of function definitions from different ast nodes like
3182  * ast::FunctionBlock, ast::ProcedureBlock, the arguments are store in the
3183  * ast::Argument. For example, in below NMODL construct, `weight` is stored as
3184  * ast::Argument::name and `uS` is stored as ast::Argument::unit:
3185  *
3186  * \code {.mod}
3187  * NET_RECEIVE(weight (uS)) {
3188  * g = g + weight
3189  * }
3190  * \endcode
3191  *
3192  */
3193 class Argument : public Identifier {
3194 private:
3195  /// Name of the argument
3196  std::shared_ptr<Identifier> name;
3197  /// Unit of the argument
3198  std::shared_ptr<Unit> unit;
3199  /// token with location information
3200  std::shared_ptr<ModToken> token;
3201 
3202 public:
3203  /// \name Ctor & dtor
3204  /// \{
3205 
3206  explicit Argument(Identifier *name, Unit *unit);
3207  explicit Argument(const std::shared_ptr<Identifier> &name,
3208  const std::shared_ptr<Unit> &unit);
3209  Argument(const Argument &obj);
3210 
3211  virtual ~Argument() = default;
3212 
3213  /// \}
3214 
3215  /**
3216  * \brief Check if the ast node is an instance of ast::Argument
3217  * \return true as object is of type ast::Argument
3218  */
3219  bool is_argument() const noexcept override { return true; }
3220 
3221  /**
3222  * \brief Return a copy of the current node
3223  *
3224  * Recursively make a new copy/clone of the current node including
3225  * all members and return a pointer to the node. This is used for
3226  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
3227  * ast.
3228  *
3229  * @return pointer to the clone/copy of the current node
3230  */
3231  Argument *clone() const override { return new Argument(*this); }
3232 
3233  /// \name Getters
3234  /// \{
3235 
3236  /**
3237  * \brief Return type (ast::AstNodeType) of ast node
3238  *
3239  * Every node in the ast has a type defined in ast::AstNodeType and this
3240  * function is used to retrieve the same.
3241  *
3242  * \return ast node type i.e. ast::AstNodeType::ARGUMENT
3243  *
3244  * \sa Ast::get_node_type_name
3245  */
3246  AstNodeType get_node_type() const noexcept override {
3247  return AstNodeType::ARGUMENT;
3248  }
3249 
3250  /**
3251  * \brief Return type (ast::AstNodeType) of ast node as std::string
3252  *
3253  * Every node in the ast has a type defined in ast::AstNodeType.
3254  * This type name can be returned as a std::string for printing
3255  * node to text/json form.
3256  *
3257  * \return name of the node type as a string i.e. "Argument"
3258  *
3259  * \sa Ast::get_node_name
3260  */
3261  std::string get_node_type_name() const noexcept override {
3262  return "Argument";
3263  }
3264 
3265  /**
3266  * \brief Get std::shared_ptr from `this` pointer of the current ast node
3267  */
3268  std::shared_ptr<Ast> get_shared_ptr() override {
3269  return std::static_pointer_cast<Argument>(shared_from_this());
3270  }
3271 
3272  /**
3273  * \brief Get std::shared_ptr from `this` pointer of the current ast node
3274  */
3275  std::shared_ptr<const Ast> get_shared_ptr() const override {
3276  return std::static_pointer_cast<const Argument>(shared_from_this());
3277  }
3278 
3279  /**
3280  * \brief Return associated token for the current ast node
3281  *
3282  * Not all ast nodes have token information. For example,
3283  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
3284  * solution of ODEs. In this case, we return nullptr to store in the
3285  * nmodl::symtab::SymbolTable.
3286  *
3287  * \return pointer to token if exist otherwise nullptr
3288  */
3289  const ModToken *get_token() const noexcept override { return token.get(); }
3290 
3291  /**
3292  * \brief Return name of the node
3293  *
3294  * Some ast nodes have a member marked designated as node name. For example,
3295  * in case of this ast::Identifier has name designated as a
3296  * node name.
3297  *
3298  * @return name of the node as std::string
3299  *
3300  * \sa Ast::get_node_type_name
3301  */
3302  std::string get_node_name() const override;
3303 
3304  /**
3305  * \brief Getter for member variable \ref Argument.name
3306  */
3307  const std::shared_ptr<Identifier> &get_name() const noexcept { return name; }
3308 
3309  /**
3310  * \brief Getter for member variable \ref Argument.unit
3311  */
3312  const std::shared_ptr<Unit> &get_unit() const noexcept { return unit; }
3313 
3314  /// \}
3315 
3316  /// \name Setters
3317  /// \{
3318 
3319  /**
3320  * \brief Set token for the current ast node
3321  */
3322  void set_token(const ModToken &tok) {
3323  token = std::make_shared<ModToken>(tok);
3324  }
3325 
3326  /**
3327  * \brief Setter for member variable \ref Argument.name (rvalue reference)
3328  */
3329  void set_name(std::shared_ptr<Identifier> &&name);
3330 
3331  /**
3332  * \brief Setter for member variable \ref Argument.name
3333  */
3334  void set_name(const std::shared_ptr<Identifier> &name);
3335 
3336  /**
3337  * \brief Setter for member variable \ref Argument.unit (rvalue reference)
3338  */
3339  void set_unit(std::shared_ptr<Unit> &&unit);
3340 
3341  /**
3342  * \brief Setter for member variable \ref Argument.unit
3343  */
3344  void set_unit(const std::shared_ptr<Unit> &unit);
3345 
3346  /// \}
3347 
3348  /// \name Visitor
3349  /// \{
3350 
3351  /**
3352  * \brief visit children i.e. member variables of current node using provided
3353  * visitor
3354  *
3355  * Different nodes in the AST have different members (i.e. children). This
3356  * method recursively visits children using provided visitor.
3357  *
3358  * \param v Concrete visitor that will be used to recursively visit children
3359  *
3360  * \sa Ast::visit_children for example.
3361  */
3362  void visit_children(visitor::Visitor &v) override;
3363 
3364  /**
3365  * \brief visit children i.e. member variables of current node using provided
3366  * visitor
3367  *
3368  * Different nodes in the AST have different members (i.e. children). This
3369  * method recursively visits children using provided visitor.
3370  *
3371  * \param v Concrete constant visitor that will be used to recursively visit
3372  * children
3373  *
3374  * \sa Ast::visit_children for example.
3375  */
3376  void visit_children(visitor::ConstVisitor &v) const override;
3377 
3378  /**
3379  * \brief accept (or visit) the current AST node using provided visitor
3380  *
3381  * Instead of visiting children of AST node, like Ast::visit_children,
3382  * accept allows to visit the current node itself using provided concrete
3383  * visitor.
3384  *
3385  * \param v Concrete visitor that will be used to recursively visit node
3386  *
3387  * \sa Ast::accept for example.
3388  */
3389  void accept(visitor::Visitor &v) override;
3390 
3391  /**
3392  * \copydoc accept(visitor::Visitor&)
3393  */
3394  void accept(visitor::ConstVisitor &v) const override;
3395 
3396  /// \}
3397 
3398 private:
3399  /**
3400  * \brief Set this object as parent for all the children
3401  *
3402  * This should be called in every object (with children) constructor
3403  * to set parents. Since it is called only in the constructors it
3404  * should not be virtual to avoid ambiguities (issue #295).
3405  */
3406  void set_parent_in_children();
3407 };
3408 
3409 /** @} */ // end of ast_class
3410 
3411 } // namespace ast
3412 } // namespace nmodl
3413 #endif // !NMODL_AST_ARGUMENT_HPP
3414 #ifndef NMODL_AST_REACT_VAR_NAME_HPP
3415 #define NMODL_AST_REACT_VAR_NAME_HPP
3416 
3417 namespace nmodl {
3418 namespace ast {
3419 
3420 /**
3421  * @addtogroup ast_class
3422  * @ingroup ast
3423  * @{
3424  */
3425 
3426 /**
3427  * \brief TODO
3428  *
3429  *
3430  */
3431 class ReactVarName : public Identifier {
3432 private:
3433  /// TODO
3434  std::shared_ptr<Integer> value;
3435  /// TODO
3436  std::shared_ptr<VarName> name;
3437  /// token with location information
3438  std::shared_ptr<ModToken> token;
3439 
3440 public:
3441  /// \name Ctor & dtor
3442  /// \{
3443 
3444  explicit ReactVarName(Integer *value, VarName *name);
3445  explicit ReactVarName(const std::shared_ptr<Integer> &value,
3446  const std::shared_ptr<VarName> &name);
3447  ReactVarName(const ReactVarName &obj);
3448 
3449  virtual ~ReactVarName() = default;
3450 
3451  /// \}
3452 
3453  /**
3454  * \brief Check if the ast node is an instance of ast::ReactVarName
3455  * \return true as object is of type ast::ReactVarName
3456  */
3457  bool is_react_var_name() const noexcept override { return true; }
3458 
3459  /**
3460  * \brief Return a copy of the current node
3461  *
3462  * Recursively make a new copy/clone of the current node including
3463  * all members and return a pointer to the node. This is used for
3464  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
3465  * ast.
3466  *
3467  * @return pointer to the clone/copy of the current node
3468  */
3469  ReactVarName *clone() const override { return new ReactVarName(*this); }
3470 
3471  /// \name Getters
3472  /// \{
3473 
3474  /**
3475  * \brief Return type (ast::AstNodeType) of ast node
3476  *
3477  * Every node in the ast has a type defined in ast::AstNodeType and this
3478  * function is used to retrieve the same.
3479  *
3480  * \return ast node type i.e. ast::AstNodeType::REACT_VAR_NAME
3481  *
3482  * \sa Ast::get_node_type_name
3483  */
3484  AstNodeType get_node_type() const noexcept override {
3486  }
3487 
3488  /**
3489  * \brief Return type (ast::AstNodeType) of ast node as std::string
3490  *
3491  * Every node in the ast has a type defined in ast::AstNodeType.
3492  * This type name can be returned as a std::string for printing
3493  * node to text/json form.
3494  *
3495  * \return name of the node type as a string i.e. "ReactVarName"
3496  *
3497  * \sa Ast::get_node_name
3498  */
3499  std::string get_node_type_name() const noexcept override {
3500  return "ReactVarName";
3501  }
3502 
3503  /**
3504  * \brief Get std::shared_ptr from `this` pointer of the current ast node
3505  */
3506  std::shared_ptr<Ast> get_shared_ptr() override {
3507  return std::static_pointer_cast<ReactVarName>(shared_from_this());
3508  }
3509 
3510  /**
3511  * \brief Get std::shared_ptr from `this` pointer of the current ast node
3512  */
3513  std::shared_ptr<const Ast> get_shared_ptr() const override {
3514  return std::static_pointer_cast<const ReactVarName>(shared_from_this());
3515  }
3516 
3517  /**
3518  * \brief Return associated token for the current ast node
3519  *
3520  * Not all ast nodes have token information. For example,
3521  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
3522  * solution of ODEs. In this case, we return nullptr to store in the
3523  * nmodl::symtab::SymbolTable.
3524  *
3525  * \return pointer to token if exist otherwise nullptr
3526  */
3527  const ModToken *get_token() const noexcept override { return token.get(); }
3528 
3529  /**
3530  * \brief Getter for member variable \ref ReactVarName.value
3531  */
3532  const std::shared_ptr<Integer> &get_value() const noexcept { return value; }
3533 
3534  /**
3535  * \brief Return name of the node
3536  *
3537  * Some ast nodes have a member marked designated as node name. For example,
3538  * in case of this ast::VarName has name designated as a
3539  * node name.
3540  *
3541  * @return name of the node as std::string
3542  *
3543  * \sa Ast::get_node_type_name
3544  */
3545  std::string get_node_name() const override;
3546 
3547  /**
3548  * \brief Getter for member variable \ref ReactVarName.name
3549  */
3550  const std::shared_ptr<VarName> &get_name() const noexcept { return name; }
3551 
3552  /// \}
3553 
3554  /// \name Setters
3555  /// \{
3556 
3557  /**
3558  * \brief Set token for the current ast node
3559  */
3560  void set_token(const ModToken &tok) {
3561  token = std::make_shared<ModToken>(tok);
3562  }
3563 
3564  /**
3565  * \brief Setter for member variable \ref ReactVarName.value (rvalue
3566  * reference)
3567  */
3568  void set_value(std::shared_ptr<Integer> &&value);
3569 
3570  /**
3571  * \brief Setter for member variable \ref ReactVarName.value
3572  */
3573  void set_value(const std::shared_ptr<Integer> &value);
3574 
3575  /**
3576  * \brief Setter for member variable \ref ReactVarName.name (rvalue reference)
3577  */
3578  void set_name(std::shared_ptr<VarName> &&name);
3579 
3580  /**
3581  * \brief Setter for member variable \ref ReactVarName.name
3582  */
3583  void set_name(const std::shared_ptr<VarName> &name);
3584 
3585  /// \}
3586 
3587  /// \name Visitor
3588  /// \{
3589 
3590  /**
3591  * \brief visit children i.e. member variables of current node using provided
3592  * visitor
3593  *
3594  * Different nodes in the AST have different members (i.e. children). This
3595  * method recursively visits children using provided visitor.
3596  *
3597  * \param v Concrete visitor that will be used to recursively visit children
3598  *
3599  * \sa Ast::visit_children for example.
3600  */
3601  void visit_children(visitor::Visitor &v) override;
3602 
3603  /**
3604  * \brief visit children i.e. member variables of current node using provided
3605  * visitor
3606  *
3607  * Different nodes in the AST have different members (i.e. children). This
3608  * method recursively visits children using provided visitor.
3609  *
3610  * \param v Concrete constant visitor that will be used to recursively visit
3611  * children
3612  *
3613  * \sa Ast::visit_children for example.
3614  */
3615  void visit_children(visitor::ConstVisitor &v) const override;
3616 
3617  /**
3618  * \brief accept (or visit) the current AST node using provided visitor
3619  *
3620  * Instead of visiting children of AST node, like Ast::visit_children,
3621  * accept allows to visit the current node itself using provided concrete
3622  * visitor.
3623  *
3624  * \param v Concrete visitor that will be used to recursively visit node
3625  *
3626  * \sa Ast::accept for example.
3627  */
3628  void accept(visitor::Visitor &v) override;
3629 
3630  /**
3631  * \copydoc accept(visitor::Visitor&)
3632  */
3633  void accept(visitor::ConstVisitor &v) const override;
3634 
3635  /// \}
3636 
3637 private:
3638  /**
3639  * \brief Set this object as parent for all the children
3640  *
3641  * This should be called in every object (with children) constructor
3642  * to set parents. Since it is called only in the constructors it
3643  * should not be virtual to avoid ambiguities (issue #295).
3644  */
3645  void set_parent_in_children();
3646 };
3647 
3648 /** @} */ // end of ast_class
3649 
3650 } // namespace ast
3651 } // namespace nmodl
3652 #endif // !NMODL_AST_REACT_VAR_NAME_HPP
3653 #ifndef NMODL_AST_READ_ION_VAR_HPP
3654 #define NMODL_AST_READ_ION_VAR_HPP
3655 
3656 namespace nmodl {
3657 namespace ast {
3658 
3659 /**
3660  * @addtogroup ast_class
3661  * @ingroup ast
3662  * @{
3663  */
3664 
3665 /**
3666  * \brief TODO
3667  *
3668  *
3669  */
3670 class ReadIonVar : public Identifier {
3671 private:
3672  /// TODO
3673  std::shared_ptr<Name> name;
3674  /// token with location information
3675  std::shared_ptr<ModToken> token;
3676 
3677 public:
3678  /// \name Ctor & dtor
3679  /// \{
3680 
3681  explicit ReadIonVar(Name *name);
3682  explicit ReadIonVar(const std::shared_ptr<Name> &name);
3683  ReadIonVar(const ReadIonVar &obj);
3684 
3685  virtual ~ReadIonVar() = default;
3686 
3687  /// \}
3688 
3689  /**
3690  * \brief Check if the ast node is an instance of ast::ReadIonVar
3691  * \return true as object is of type ast::ReadIonVar
3692  */
3693  bool is_read_ion_var() const noexcept override { return true; }
3694 
3695  /**
3696  * \brief Return a copy of the current node
3697  *
3698  * Recursively make a new copy/clone of the current node including
3699  * all members and return a pointer to the node. This is used for
3700  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
3701  * ast.
3702  *
3703  * @return pointer to the clone/copy of the current node
3704  */
3705  ReadIonVar *clone() const override { return new ReadIonVar(*this); }
3706 
3707  /// \name Getters
3708  /// \{
3709 
3710  /**
3711  * \brief Return type (ast::AstNodeType) of ast node
3712  *
3713  * Every node in the ast has a type defined in ast::AstNodeType and this
3714  * function is used to retrieve the same.
3715  *
3716  * \return ast node type i.e. ast::AstNodeType::READ_ION_VAR
3717  *
3718  * \sa Ast::get_node_type_name
3719  */
3720  AstNodeType get_node_type() const noexcept override {
3722  }
3723 
3724  /**
3725  * \brief Return type (ast::AstNodeType) of ast node as std::string
3726  *
3727  * Every node in the ast has a type defined in ast::AstNodeType.
3728  * This type name can be returned as a std::string for printing
3729  * node to text/json form.
3730  *
3731  * \return name of the node type as a string i.e. "ReadIonVar"
3732  *
3733  * \sa Ast::get_node_name
3734  */
3735  std::string get_node_type_name() const noexcept override {
3736  return "ReadIonVar";
3737  }
3738 
3739  /**
3740  * \brief Get std::shared_ptr from `this` pointer of the current ast node
3741  */
3742  std::shared_ptr<Ast> get_shared_ptr() override {
3743  return std::static_pointer_cast<ReadIonVar>(shared_from_this());
3744  }
3745 
3746  /**
3747  * \brief Get std::shared_ptr from `this` pointer of the current ast node
3748  */
3749  std::shared_ptr<const Ast> get_shared_ptr() const override {
3750  return std::static_pointer_cast<const ReadIonVar>(shared_from_this());
3751  }
3752 
3753  /**
3754  * \brief Return associated token for the current ast node
3755  *
3756  * Not all ast nodes have token information. For example,
3757  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
3758  * solution of ODEs. In this case, we return nullptr to store in the
3759  * nmodl::symtab::SymbolTable.
3760  *
3761  * \return pointer to token if exist otherwise nullptr
3762  */
3763  const ModToken *get_token() const noexcept override { return token.get(); }
3764 
3765  /**
3766  * \brief Return name of the node
3767  *
3768  * Some ast nodes have a member marked designated as node name. For example,
3769  * in case of this ast::Name has name designated as a
3770  * node name.
3771  *
3772  * @return name of the node as std::string
3773  *
3774  * \sa Ast::get_node_type_name
3775  */
3776  std::string get_node_name() const override;
3777 
3778  /**
3779  * \brief Getter for member variable \ref ReadIonVar.name
3780  */
3781  const std::shared_ptr<Name> &get_name() const noexcept { return name; }
3782 
3783  /// \}
3784 
3785  /// \name Setters
3786  /// \{
3787 
3788  /**
3789  * \brief Set token for the current ast node
3790  */
3791  void set_token(const ModToken &tok) {
3792  token = std::make_shared<ModToken>(tok);
3793  }
3794 
3795  /**
3796  * \brief Setter for member variable \ref ReadIonVar.name (rvalue reference)
3797  */
3798  void set_name(std::shared_ptr<Name> &&name);
3799 
3800  /**
3801  * \brief Setter for member variable \ref ReadIonVar.name
3802  */
3803  void set_name(const std::shared_ptr<Name> &name);
3804 
3805  /// \}
3806 
3807  /// \name Visitor
3808  /// \{
3809 
3810  /**
3811  * \brief visit children i.e. member variables of current node using provided
3812  * visitor
3813  *
3814  * Different nodes in the AST have different members (i.e. children). This
3815  * method recursively visits children using provided visitor.
3816  *
3817  * \param v Concrete visitor that will be used to recursively visit children
3818  *
3819  * \sa Ast::visit_children for example.
3820  */
3821  void visit_children(visitor::Visitor &v) override;
3822 
3823  /**
3824  * \brief visit children i.e. member variables of current node using provided
3825  * visitor
3826  *
3827  * Different nodes in the AST have different members (i.e. children). This
3828  * method recursively visits children using provided visitor.
3829  *
3830  * \param v Concrete constant visitor that will be used to recursively visit
3831  * children
3832  *
3833  * \sa Ast::visit_children for example.
3834  */
3835  void visit_children(visitor::ConstVisitor &v) const override;
3836 
3837  /**
3838  * \brief accept (or visit) the current AST node using provided visitor
3839  *
3840  * Instead of visiting children of AST node, like Ast::visit_children,
3841  * accept allows to visit the current node itself using provided concrete
3842  * visitor.
3843  *
3844  * \param v Concrete visitor that will be used to recursively visit node
3845  *
3846  * \sa Ast::accept for example.
3847  */
3848  void accept(visitor::Visitor &v) override;
3849 
3850  /**
3851  * \copydoc accept(visitor::Visitor&)
3852  */
3853  void accept(visitor::ConstVisitor &v) const override;
3854 
3855  /// \}
3856 
3857 private:
3858  /**
3859  * \brief Set this object as parent for all the children
3860  *
3861  * This should be called in every object (with children) constructor
3862  * to set parents. Since it is called only in the constructors it
3863  * should not be virtual to avoid ambiguities (issue #295).
3864  */
3865  void set_parent_in_children();
3866 };
3867 
3868 /** @} */ // end of ast_class
3869 
3870 } // namespace ast
3871 } // namespace nmodl
3872 #endif // !NMODL_AST_READ_ION_VAR_HPP
3873 #ifndef NMODL_AST_WRITE_ION_VAR_HPP
3874 #define NMODL_AST_WRITE_ION_VAR_HPP
3875 
3876 namespace nmodl {
3877 namespace ast {
3878 
3879 /**
3880  * @addtogroup ast_class
3881  * @ingroup ast
3882  * @{
3883  */
3884 
3885 /**
3886  * \brief TODO
3887  *
3888  *
3889  */
3890 class WriteIonVar : public Identifier {
3891 private:
3892  /// TODO
3893  std::shared_ptr<Name> name;
3894  /// token with location information
3895  std::shared_ptr<ModToken> token;
3896 
3897 public:
3898  /// \name Ctor & dtor
3899  /// \{
3900 
3901  explicit WriteIonVar(Name *name);
3902  explicit WriteIonVar(const std::shared_ptr<Name> &name);
3903  WriteIonVar(const WriteIonVar &obj);
3904 
3905  virtual ~WriteIonVar() = default;
3906 
3907  /// \}
3908 
3909  /**
3910  * \brief Check if the ast node is an instance of ast::WriteIonVar
3911  * \return true as object is of type ast::WriteIonVar
3912  */
3913  bool is_write_ion_var() const noexcept override { return true; }
3914 
3915  /**
3916  * \brief Return a copy of the current node
3917  *
3918  * Recursively make a new copy/clone of the current node including
3919  * all members and return a pointer to the node. This is used for
3920  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
3921  * ast.
3922  *
3923  * @return pointer to the clone/copy of the current node
3924  */
3925  WriteIonVar *clone() const override { return new WriteIonVar(*this); }
3926 
3927  /// \name Getters
3928  /// \{
3929 
3930  /**
3931  * \brief Return type (ast::AstNodeType) of ast node
3932  *
3933  * Every node in the ast has a type defined in ast::AstNodeType and this
3934  * function is used to retrieve the same.
3935  *
3936  * \return ast node type i.e. ast::AstNodeType::WRITE_ION_VAR
3937  *
3938  * \sa Ast::get_node_type_name
3939  */
3940  AstNodeType get_node_type() const noexcept override {
3942  }
3943 
3944  /**
3945  * \brief Return type (ast::AstNodeType) of ast node as std::string
3946  *
3947  * Every node in the ast has a type defined in ast::AstNodeType.
3948  * This type name can be returned as a std::string for printing
3949  * node to text/json form.
3950  *
3951  * \return name of the node type as a string i.e. "WriteIonVar"
3952  *
3953  * \sa Ast::get_node_name
3954  */
3955  std::string get_node_type_name() const noexcept override {
3956  return "WriteIonVar";
3957  }
3958 
3959  /**
3960  * \brief Get std::shared_ptr from `this` pointer of the current ast node
3961  */
3962  std::shared_ptr<Ast> get_shared_ptr() override {
3963  return std::static_pointer_cast<WriteIonVar>(shared_from_this());
3964  }
3965 
3966  /**
3967  * \brief Get std::shared_ptr from `this` pointer of the current ast node
3968  */
3969  std::shared_ptr<const Ast> get_shared_ptr() const override {
3970  return std::static_pointer_cast<const WriteIonVar>(shared_from_this());
3971  }
3972 
3973  /**
3974  * \brief Return associated token for the current ast node
3975  *
3976  * Not all ast nodes have token information. For example,
3977  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
3978  * solution of ODEs. In this case, we return nullptr to store in the
3979  * nmodl::symtab::SymbolTable.
3980  *
3981  * \return pointer to token if exist otherwise nullptr
3982  */
3983  const ModToken *get_token() const noexcept override { return token.get(); }
3984 
3985  /**
3986  * \brief Return name of the node
3987  *
3988  * Some ast nodes have a member marked designated as node name. For example,
3989  * in case of this ast::Name has name designated as a
3990  * node name.
3991  *
3992  * @return name of the node as std::string
3993  *
3994  * \sa Ast::get_node_type_name
3995  */
3996  std::string get_node_name() const override;
3997 
3998  /**
3999  * \brief Getter for member variable \ref WriteIonVar.name
4000  */
4001  const std::shared_ptr<Name> &get_name() const noexcept { return name; }
4002 
4003  /// \}
4004 
4005  /// \name Setters
4006  /// \{
4007 
4008  /**
4009  * \brief Set token for the current ast node
4010  */
4011  void set_token(const ModToken &tok) {
4012  token = std::make_shared<ModToken>(tok);
4013  }
4014 
4015  /**
4016  * \brief Setter for member variable \ref WriteIonVar.name (rvalue reference)
4017  */
4018  void set_name(std::shared_ptr<Name> &&name);
4019 
4020  /**
4021  * \brief Setter for member variable \ref WriteIonVar.name
4022  */
4023  void set_name(const std::shared_ptr<Name> &name);
4024 
4025  /// \}
4026 
4027  /// \name Visitor
4028  /// \{
4029 
4030  /**
4031  * \brief visit children i.e. member variables of current node using provided
4032  * visitor
4033  *
4034  * Different nodes in the AST have different members (i.e. children). This
4035  * method recursively visits children using provided visitor.
4036  *
4037  * \param v Concrete visitor that will be used to recursively visit children
4038  *
4039  * \sa Ast::visit_children for example.
4040  */
4041  void visit_children(visitor::Visitor &v) override;
4042 
4043  /**
4044  * \brief visit children i.e. member variables of current node using provided
4045  * visitor
4046  *
4047  * Different nodes in the AST have different members (i.e. children). This
4048  * method recursively visits children using provided visitor.
4049  *
4050  * \param v Concrete constant visitor that will be used to recursively visit
4051  * children
4052  *
4053  * \sa Ast::visit_children for example.
4054  */
4055  void visit_children(visitor::ConstVisitor &v) const override;
4056 
4057  /**
4058  * \brief accept (or visit) the current AST node using provided visitor
4059  *
4060  * Instead of visiting children of AST node, like Ast::visit_children,
4061  * accept allows to visit the current node itself using provided concrete
4062  * visitor.
4063  *
4064  * \param v Concrete visitor that will be used to recursively visit node
4065  *
4066  * \sa Ast::accept for example.
4067  */
4068  void accept(visitor::Visitor &v) override;
4069 
4070  /**
4071  * \copydoc accept(visitor::Visitor&)
4072  */
4073  void accept(visitor::ConstVisitor &v) const override;
4074 
4075  /// \}
4076 
4077 private:
4078  /**
4079  * \brief Set this object as parent for all the children
4080  *
4081  * This should be called in every object (with children) constructor
4082  * to set parents. Since it is called only in the constructors it
4083  * should not be virtual to avoid ambiguities (issue #295).
4084  */
4085  void set_parent_in_children();
4086 };
4087 
4088 /** @} */ // end of ast_class
4089 
4090 } // namespace ast
4091 } // namespace nmodl
4092 #endif // !NMODL_AST_WRITE_ION_VAR_HPP
4093 #ifndef NMODL_AST_NONSPECIFIC_CUR_VAR_HPP
4094 #define NMODL_AST_NONSPECIFIC_CUR_VAR_HPP
4095 
4096 namespace nmodl {
4097 namespace ast {
4098 
4099 /**
4100  * @addtogroup ast_class
4101  * @ingroup ast
4102  * @{
4103  */
4104 
4105 /**
4106  * \brief TODO
4107  *
4108  *
4109  */
4111 private:
4112  /// TODO
4113  std::shared_ptr<Name> name;
4114  /// token with location information
4115  std::shared_ptr<ModToken> token;
4116 
4117 public:
4118  /// \name Ctor & dtor
4119  /// \{
4120 
4121  explicit NonspecificCurVar(Name *name);
4122  explicit NonspecificCurVar(const std::shared_ptr<Name> &name);
4124 
4125  virtual ~NonspecificCurVar() = default;
4126 
4127  /// \}
4128 
4129  /**
4130  * \brief Check if the ast node is an instance of ast::NonspecificCurVar
4131  * \return true as object is of type ast::NonspecificCurVar
4132  */
4133  bool is_nonspecific_cur_var() const noexcept override { return true; }
4134 
4135  /**
4136  * \brief Return a copy of the current node
4137  *
4138  * Recursively make a new copy/clone of the current node including
4139  * all members and return a pointer to the node. This is used for
4140  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
4141  * ast.
4142  *
4143  * @return pointer to the clone/copy of the current node
4144  */
4145  NonspecificCurVar *clone() const override {
4146  return new NonspecificCurVar(*this);
4147  }
4148 
4149  /// \name Getters
4150  /// \{
4151 
4152  /**
4153  * \brief Return type (ast::AstNodeType) of ast node
4154  *
4155  * Every node in the ast has a type defined in ast::AstNodeType and this
4156  * function is used to retrieve the same.
4157  *
4158  * \return ast node type i.e. ast::AstNodeType::NONSPECIFIC_CUR_VAR
4159  *
4160  * \sa Ast::get_node_type_name
4161  */
4162  AstNodeType get_node_type() const noexcept override {
4164  }
4165 
4166  /**
4167  * \brief Return type (ast::AstNodeType) of ast node as std::string
4168  *
4169  * Every node in the ast has a type defined in ast::AstNodeType.
4170  * This type name can be returned as a std::string for printing
4171  * node to text/json form.
4172  *
4173  * \return name of the node type as a string i.e. "NonspecificCurVar"
4174  *
4175  * \sa Ast::get_node_name
4176  */
4177  std::string get_node_type_name() const noexcept override {
4178  return "NonspecificCurVar";
4179  }
4180 
4181  /**
4182  * \brief Get std::shared_ptr from `this` pointer of the current ast node
4183  */
4184  std::shared_ptr<Ast> get_shared_ptr() override {
4185  return std::static_pointer_cast<NonspecificCurVar>(shared_from_this());
4186  }
4187 
4188  /**
4189  * \brief Get std::shared_ptr from `this` pointer of the current ast node
4190  */
4191  std::shared_ptr<const Ast> get_shared_ptr() const override {
4192  return std::static_pointer_cast<const NonspecificCurVar>(
4193  shared_from_this());
4194  }
4195 
4196  /**
4197  * \brief Return associated token for the current ast node
4198  *
4199  * Not all ast nodes have token information. For example,
4200  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
4201  * solution of ODEs. In this case, we return nullptr to store in the
4202  * nmodl::symtab::SymbolTable.
4203  *
4204  * \return pointer to token if exist otherwise nullptr
4205  */
4206  const ModToken *get_token() const noexcept override { return token.get(); }
4207 
4208  /**
4209  * \brief Return name of the node
4210  *
4211  * Some ast nodes have a member marked designated as node name. For example,
4212  * in case of this ast::Name has name designated as a
4213  * node name.
4214  *
4215  * @return name of the node as std::string
4216  *
4217  * \sa Ast::get_node_type_name
4218  */
4219  std::string get_node_name() const override;
4220 
4221  /**
4222  * \brief Getter for member variable \ref NonspecificCurVar.name
4223  */
4224  const std::shared_ptr<Name> &get_name() const noexcept { return name; }
4225 
4226  /// \}
4227 
4228  /// \name Setters
4229  /// \{
4230 
4231  /**
4232  * \brief Set token for the current ast node
4233  */
4234  void set_token(const ModToken &tok) {
4235  token = std::make_shared<ModToken>(tok);
4236  }
4237 
4238  /**
4239  * \brief Setter for member variable \ref NonspecificCurVar.name (rvalue
4240  * reference)
4241  */
4242  void set_name(std::shared_ptr<Name> &&name);
4243 
4244  /**
4245  * \brief Setter for member variable \ref NonspecificCurVar.name
4246  */
4247  void set_name(const std::shared_ptr<Name> &name);
4248 
4249  /// \}
4250 
4251  /// \name Visitor
4252  /// \{
4253 
4254  /**
4255  * \brief visit children i.e. member variables of current node using provided
4256  * visitor
4257  *
4258  * Different nodes in the AST have different members (i.e. children). This
4259  * method recursively visits children using provided visitor.
4260  *
4261  * \param v Concrete visitor that will be used to recursively visit children
4262  *
4263  * \sa Ast::visit_children for example.
4264  */
4265  void visit_children(visitor::Visitor &v) override;
4266 
4267  /**
4268  * \brief visit children i.e. member variables of current node using provided
4269  * visitor
4270  *
4271  * Different nodes in the AST have different members (i.e. children). This
4272  * method recursively visits children using provided visitor.
4273  *
4274  * \param v Concrete constant visitor that will be used to recursively visit
4275  * children
4276  *
4277  * \sa Ast::visit_children for example.
4278  */
4279  void visit_children(visitor::ConstVisitor &v) const override;
4280 
4281  /**
4282  * \brief accept (or visit) the current AST node using provided visitor
4283  *
4284  * Instead of visiting children of AST node, like Ast::visit_children,
4285  * accept allows to visit the current node itself using provided concrete
4286  * visitor.
4287  *
4288  * \param v Concrete visitor that will be used to recursively visit node
4289  *
4290  * \sa Ast::accept for example.
4291  */
4292  void accept(visitor::Visitor &v) override;
4293 
4294  /**
4295  * \copydoc accept(visitor::Visitor&)
4296  */
4297  void accept(visitor::ConstVisitor &v) const override;
4298 
4299  /// \}
4300 
4301 private:
4302  /**
4303  * \brief Set this object as parent for all the children
4304  *
4305  * This should be called in every object (with children) constructor
4306  * to set parents. Since it is called only in the constructors it
4307  * should not be virtual to avoid ambiguities (issue #295).
4308  */
4309  void set_parent_in_children();
4310 };
4311 
4312 /** @} */ // end of ast_class
4313 
4314 } // namespace ast
4315 } // namespace nmodl
4316 #endif // !NMODL_AST_NONSPECIFIC_CUR_VAR_HPP
4317 #ifndef NMODL_AST_ELECTRODE_CUR_VAR_HPP
4318 #define NMODL_AST_ELECTRODE_CUR_VAR_HPP
4319 
4320 namespace nmodl {
4321 namespace ast {
4322 
4323 /**
4324  * @addtogroup ast_class
4325  * @ingroup ast
4326  * @{
4327  */
4328 
4329 /**
4330  * \brief TODO
4331  *
4332  *
4333  */
4334 class ElectrodeCurVar : public Identifier {
4335 private:
4336  /// TODO
4337  std::shared_ptr<Name> name;
4338  /// token with location information
4339  std::shared_ptr<ModToken> token;
4340 
4341 public:
4342  /// \name Ctor & dtor
4343  /// \{
4344 
4345  explicit ElectrodeCurVar(Name *name);
4346  explicit ElectrodeCurVar(const std::shared_ptr<Name> &name);
4347  ElectrodeCurVar(const ElectrodeCurVar &obj);
4348 
4349  virtual ~ElectrodeCurVar() = default;
4350 
4351  /// \}
4352 
4353  /**
4354  * \brief Check if the ast node is an instance of ast::ElectrodeCurVar
4355  * \return true as object is of type ast::ElectrodeCurVar
4356  */
4357  bool is_electrode_cur_var() const noexcept override { return true; }
4358 
4359  /**
4360  * \brief Return a copy of the current node
4361  *
4362  * Recursively make a new copy/clone of the current node including
4363  * all members and return a pointer to the node. This is used for
4364  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
4365  * ast.
4366  *
4367  * @return pointer to the clone/copy of the current node
4368  */
4369  ElectrodeCurVar *clone() const override { return new ElectrodeCurVar(*this); }
4370 
4371  /// \name Getters
4372  /// \{
4373 
4374  /**
4375  * \brief Return type (ast::AstNodeType) of ast node
4376  *
4377  * Every node in the ast has a type defined in ast::AstNodeType and this
4378  * function is used to retrieve the same.
4379  *
4380  * \return ast node type i.e. ast::AstNodeType::ELECTRODE_CUR_VAR
4381  *
4382  * \sa Ast::get_node_type_name
4383  */
4384  AstNodeType get_node_type() const noexcept override {
4386  }
4387 
4388  /**
4389  * \brief Return type (ast::AstNodeType) of ast node as std::string
4390  *
4391  * Every node in the ast has a type defined in ast::AstNodeType.
4392  * This type name can be returned as a std::string for printing
4393  * node to text/json form.
4394  *
4395  * \return name of the node type as a string i.e. "ElectrodeCurVar"
4396  *
4397  * \sa Ast::get_node_name
4398  */
4399  std::string get_node_type_name() const noexcept override {
4400  return "ElectrodeCurVar";
4401  }
4402 
4403  /**
4404  * \brief Get std::shared_ptr from `this` pointer of the current ast node
4405  */
4406  std::shared_ptr<Ast> get_shared_ptr() override {
4407  return std::static_pointer_cast<ElectrodeCurVar>(shared_from_this());
4408  }
4409 
4410  /**
4411  * \brief Get std::shared_ptr from `this` pointer of the current ast node
4412  */
4413  std::shared_ptr<const Ast> get_shared_ptr() const override {
4414  return std::static_pointer_cast<const ElectrodeCurVar>(shared_from_this());
4415  }
4416 
4417  /**
4418  * \brief Return associated token for the current ast node
4419  *
4420  * Not all ast nodes have token information. For example,
4421  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
4422  * solution of ODEs. In this case, we return nullptr to store in the
4423  * nmodl::symtab::SymbolTable.
4424  *
4425  * \return pointer to token if exist otherwise nullptr
4426  */
4427  const ModToken *get_token() const noexcept override { return token.get(); }
4428 
4429  /**
4430  * \brief Return name of the node
4431  *
4432  * Some ast nodes have a member marked designated as node name. For example,
4433  * in case of this ast::Name has name designated as a
4434  * node name.
4435  *
4436  * @return name of the node as std::string
4437  *
4438  * \sa Ast::get_node_type_name
4439  */
4440  std::string get_node_name() const override;
4441 
4442  /**
4443  * \brief Getter for member variable \ref ElectrodeCurVar.name
4444  */
4445  const std::shared_ptr<Name> &get_name() const noexcept { return name; }
4446 
4447  /// \}
4448 
4449  /// \name Setters
4450  /// \{
4451 
4452  /**
4453  * \brief Set token for the current ast node
4454  */
4455  void set_token(const ModToken &tok) {
4456  token = std::make_shared<ModToken>(tok);
4457  }
4458 
4459  /**
4460  * \brief Setter for member variable \ref ElectrodeCurVar.name (rvalue
4461  * reference)
4462  */
4463  void set_name(std::shared_ptr<Name> &&name);
4464 
4465  /**
4466  * \brief Setter for member variable \ref ElectrodeCurVar.name
4467  */
4468  void set_name(const std::shared_ptr<Name> &name);
4469 
4470  /// \}
4471 
4472  /// \name Visitor
4473  /// \{
4474 
4475  /**
4476  * \brief visit children i.e. member variables of current node using provided
4477  * visitor
4478  *
4479  * Different nodes in the AST have different members (i.e. children). This
4480  * method recursively visits children using provided visitor.
4481  *
4482  * \param v Concrete visitor that will be used to recursively visit children
4483  *
4484  * \sa Ast::visit_children for example.
4485  */
4486  void visit_children(visitor::Visitor &v) override;
4487 
4488  /**
4489  * \brief visit children i.e. member variables of current node using provided
4490  * visitor
4491  *
4492  * Different nodes in the AST have different members (i.e. children). This
4493  * method recursively visits children using provided visitor.
4494  *
4495  * \param v Concrete constant visitor that will be used to recursively visit
4496  * children
4497  *
4498  * \sa Ast::visit_children for example.
4499  */
4500  void visit_children(visitor::ConstVisitor &v) const override;
4501 
4502  /**
4503  * \brief accept (or visit) the current AST node using provided visitor
4504  *
4505  * Instead of visiting children of AST node, like Ast::visit_children,
4506  * accept allows to visit the current node itself using provided concrete
4507  * visitor.
4508  *
4509  * \param v Concrete visitor that will be used to recursively visit node
4510  *
4511  * \sa Ast::accept for example.
4512  */
4513  void accept(visitor::Visitor &v) override;
4514 
4515  /**
4516  * \copydoc accept(visitor::Visitor&)
4517  */
4518  void accept(visitor::ConstVisitor &v) const override;
4519 
4520  /// \}
4521 
4522 private:
4523  /**
4524  * \brief Set this object as parent for all the children
4525  *
4526  * This should be called in every object (with children) constructor
4527  * to set parents. Since it is called only in the constructors it
4528  * should not be virtual to avoid ambiguities (issue #295).
4529  */
4530  void set_parent_in_children();
4531 };
4532 
4533 /** @} */ // end of ast_class
4534 
4535 } // namespace ast
4536 } // namespace nmodl
4537 #endif // !NMODL_AST_ELECTRODE_CUR_VAR_HPP
4538 #ifndef NMODL_AST_SECTION_VAR_HPP
4539 #define NMODL_AST_SECTION_VAR_HPP
4540 
4541 namespace nmodl {
4542 namespace ast {
4543 
4544 /**
4545  * @addtogroup ast_class
4546  * @ingroup ast
4547  * @{
4548  */
4549 
4550 /**
4551  * \brief TODO
4552  *
4553  *
4554  */
4555 class SectionVar : public Identifier {
4556 private:
4557  /// TODO
4558  std::shared_ptr<Name> name;
4559  /// token with location information
4560  std::shared_ptr<ModToken> token;
4561 
4562 public:
4563  /// \name Ctor & dtor
4564  /// \{
4565 
4566  explicit SectionVar(Name *name);
4567  explicit SectionVar(const std::shared_ptr<Name> &name);
4568  SectionVar(const SectionVar &obj);
4569 
4570  virtual ~SectionVar() = default;
4571 
4572  /// \}
4573 
4574  /**
4575  * \brief Check if the ast node is an instance of ast::SectionVar
4576  * \return true as object is of type ast::SectionVar
4577  */
4578  bool is_section_var() const noexcept override { return true; }
4579 
4580  /**
4581  * \brief Return a copy of the current node
4582  *
4583  * Recursively make a new copy/clone of the current node including
4584  * all members and return a pointer to the node. This is used for
4585  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
4586  * ast.
4587  *
4588  * @return pointer to the clone/copy of the current node
4589  */
4590  SectionVar *clone() const override { return new SectionVar(*this); }
4591 
4592  /// \name Getters
4593  /// \{
4594 
4595  /**
4596  * \brief Return type (ast::AstNodeType) of ast node
4597  *
4598  * Every node in the ast has a type defined in ast::AstNodeType and this
4599  * function is used to retrieve the same.
4600  *
4601  * \return ast node type i.e. ast::AstNodeType::SECTION_VAR
4602  *
4603  * \sa Ast::get_node_type_name
4604  */
4605  AstNodeType get_node_type() const noexcept override {
4606  return AstNodeType::SECTION_VAR;
4607  }
4608 
4609  /**
4610  * \brief Return type (ast::AstNodeType) of ast node as std::string
4611  *
4612  * Every node in the ast has a type defined in ast::AstNodeType.
4613  * This type name can be returned as a std::string for printing
4614  * node to text/json form.
4615  *
4616  * \return name of the node type as a string i.e. "SectionVar"
4617  *
4618  * \sa Ast::get_node_name
4619  */
4620  std::string get_node_type_name() const noexcept override {
4621  return "SectionVar";
4622  }
4623 
4624  /**
4625  * \brief Get std::shared_ptr from `this` pointer of the current ast node
4626  */
4627  std::shared_ptr<Ast> get_shared_ptr() override {
4628  return std::static_pointer_cast<SectionVar>(shared_from_this());
4629  }
4630 
4631  /**
4632  * \brief Get std::shared_ptr from `this` pointer of the current ast node
4633  */
4634  std::shared_ptr<const Ast> get_shared_ptr() const override {
4635  return std::static_pointer_cast<const SectionVar>(shared_from_this());
4636  }
4637 
4638  /**
4639  * \brief Return associated token for the current ast node
4640  *
4641  * Not all ast nodes have token information. For example,
4642  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
4643  * solution of ODEs. In this case, we return nullptr to store in the
4644  * nmodl::symtab::SymbolTable.
4645  *
4646  * \return pointer to token if exist otherwise nullptr
4647  */
4648  const ModToken *get_token() const noexcept override { return token.get(); }
4649 
4650  /**
4651  * \brief Return name of the node
4652  *
4653  * Some ast nodes have a member marked designated as node name. For example,
4654  * in case of this ast::Name has name designated as a
4655  * node name.
4656  *
4657  * @return name of the node as std::string
4658  *
4659  * \sa Ast::get_node_type_name
4660  */
4661  std::string get_node_name() const override;
4662 
4663  /**
4664  * \brief Getter for member variable \ref SectionVar.name
4665  */
4666  const std::shared_ptr<Name> &get_name() const noexcept { return name; }
4667 
4668  /// \}
4669 
4670  /// \name Setters
4671  /// \{
4672 
4673  /**
4674  * \brief Set token for the current ast node
4675  */
4676  void set_token(const ModToken &tok) {
4677  token = std::make_shared<ModToken>(tok);
4678  }
4679 
4680  /**
4681  * \brief Setter for member variable \ref SectionVar.name (rvalue reference)
4682  */
4683  void set_name(std::shared_ptr<Name> &&name);
4684 
4685  /**
4686  * \brief Setter for member variable \ref SectionVar.name
4687  */
4688  void set_name(const std::shared_ptr<Name> &name);
4689 
4690  /// \}
4691 
4692  /// \name Visitor
4693  /// \{
4694 
4695  /**
4696  * \brief visit children i.e. member variables of current node using provided
4697  * visitor
4698  *
4699  * Different nodes in the AST have different members (i.e. children). This
4700  * method recursively visits children using provided visitor.
4701  *
4702  * \param v Concrete visitor that will be used to recursively visit children
4703  *
4704  * \sa Ast::visit_children for example.
4705  */
4706  void visit_children(visitor::Visitor &v) override;
4707 
4708  /**
4709  * \brief visit children i.e. member variables of current node using provided
4710  * visitor
4711  *
4712  * Different nodes in the AST have different members (i.e. children). This
4713  * method recursively visits children using provided visitor.
4714  *
4715  * \param v Concrete constant visitor that will be used to recursively visit
4716  * children
4717  *
4718  * \sa Ast::visit_children for example.
4719  */
4720  void visit_children(visitor::ConstVisitor &v) const override;
4721 
4722  /**
4723  * \brief accept (or visit) the current AST node using provided visitor
4724  *
4725  * Instead of visiting children of AST node, like Ast::visit_children,
4726  * accept allows to visit the current node itself using provided concrete
4727  * visitor.
4728  *
4729  * \param v Concrete visitor that will be used to recursively visit node
4730  *
4731  * \sa Ast::accept for example.
4732  */
4733  void accept(visitor::Visitor &v) override;
4734 
4735  /**
4736  * \copydoc accept(visitor::Visitor&)
4737  */
4738  void accept(visitor::ConstVisitor &v) const override;
4739 
4740  /// \}
4741 
4742 private:
4743  /**
4744  * \brief Set this object as parent for all the children
4745  *
4746  * This should be called in every object (with children) constructor
4747  * to set parents. Since it is called only in the constructors it
4748  * should not be virtual to avoid ambiguities (issue #295).
4749  */
4750  void set_parent_in_children();
4751 };
4752 
4753 /** @} */ // end of ast_class
4754 
4755 } // namespace ast
4756 } // namespace nmodl
4757 #endif // !NMODL_AST_SECTION_VAR_HPP
4758 #ifndef NMODL_AST_RANGE_VAR_HPP
4759 #define NMODL_AST_RANGE_VAR_HPP
4760 
4761 namespace nmodl {
4762 namespace ast {
4763 
4764 /**
4765  * @addtogroup ast_class
4766  * @ingroup ast
4767  * @{
4768  */
4769 
4770 /**
4771  * \brief TODO
4772  *
4773  *
4774  */
4775 class RangeVar : public Identifier {
4776 private:
4777  /// TODO
4778  std::shared_ptr<Name> name;
4779  /// token with location information
4780  std::shared_ptr<ModToken> token;
4781 
4782 public:
4783  /// \name Ctor & dtor
4784  /// \{
4785 
4786  explicit RangeVar(Name *name);
4787  explicit RangeVar(const std::shared_ptr<Name> &name);
4788  RangeVar(const RangeVar &obj);
4789 
4790  virtual ~RangeVar() = default;
4791 
4792  /// \}
4793 
4794  /**
4795  * \brief Check if the ast node is an instance of ast::RangeVar
4796  * \return true as object is of type ast::RangeVar
4797  */
4798  bool is_range_var() const noexcept override { return true; }
4799 
4800  /**
4801  * \brief Return a copy of the current node
4802  *
4803  * Recursively make a new copy/clone of the current node including
4804  * all members and return a pointer to the node. This is used for
4805  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
4806  * ast.
4807  *
4808  * @return pointer to the clone/copy of the current node
4809  */
4810  RangeVar *clone() const override { return new RangeVar(*this); }
4811 
4812  /// \name Getters
4813  /// \{
4814 
4815  /**
4816  * \brief Return type (ast::AstNodeType) of ast node
4817  *
4818  * Every node in the ast has a type defined in ast::AstNodeType and this
4819  * function is used to retrieve the same.
4820  *
4821  * \return ast node type i.e. ast::AstNodeType::RANGE_VAR
4822  *
4823  * \sa Ast::get_node_type_name
4824  */
4825  AstNodeType get_node_type() const noexcept override {
4826  return AstNodeType::RANGE_VAR;
4827  }
4828 
4829  /**
4830  * \brief Return type (ast::AstNodeType) of ast node as std::string
4831  *
4832  * Every node in the ast has a type defined in ast::AstNodeType.
4833  * This type name can be returned as a std::string for printing
4834  * node to text/json form.
4835  *
4836  * \return name of the node type as a string i.e. "RangeVar"
4837  *
4838  * \sa Ast::get_node_name
4839  */
4840  std::string get_node_type_name() const noexcept override {
4841  return "RangeVar";
4842  }
4843 
4844  /**
4845  * \brief Get std::shared_ptr from `this` pointer of the current ast node
4846  */
4847  std::shared_ptr<Ast> get_shared_ptr() override {
4848  return std::static_pointer_cast<RangeVar>(shared_from_this());
4849  }
4850 
4851  /**
4852  * \brief Get std::shared_ptr from `this` pointer of the current ast node
4853  */
4854  std::shared_ptr<const Ast> get_shared_ptr() const override {
4855  return std::static_pointer_cast<const RangeVar>(shared_from_this());
4856  }
4857 
4858  /**
4859  * \brief Return associated token for the current ast node
4860  *
4861  * Not all ast nodes have token information. For example,
4862  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
4863  * solution of ODEs. In this case, we return nullptr to store in the
4864  * nmodl::symtab::SymbolTable.
4865  *
4866  * \return pointer to token if exist otherwise nullptr
4867  */
4868  const ModToken *get_token() const noexcept override { return token.get(); }
4869 
4870  /**
4871  * \brief Return name of the node
4872  *
4873  * Some ast nodes have a member marked designated as node name. For example,
4874  * in case of this ast::Name has name designated as a
4875  * node name.
4876  *
4877  * @return name of the node as std::string
4878  *
4879  * \sa Ast::get_node_type_name
4880  */
4881  std::string get_node_name() const override;
4882 
4883  /**
4884  * \brief Getter for member variable \ref RangeVar.name
4885  */
4886  const std::shared_ptr<Name> &get_name() const noexcept { return name; }
4887 
4888  /// \}
4889 
4890  /// \name Setters
4891  /// \{
4892 
4893  /**
4894  * \brief Set token for the current ast node
4895  */
4896  void set_token(const ModToken &tok) {
4897  token = std::make_shared<ModToken>(tok);
4898  }
4899 
4900  /**
4901  * \brief Setter for member variable \ref RangeVar.name (rvalue reference)
4902  */
4903  void set_name(std::shared_ptr<Name> &&name);
4904 
4905  /**
4906  * \brief Setter for member variable \ref RangeVar.name
4907  */
4908  void set_name(const std::shared_ptr<Name> &name);
4909 
4910  /// \}
4911 
4912  /// \name Visitor
4913  /// \{
4914 
4915  /**
4916  * \brief visit children i.e. member variables of current node using provided
4917  * visitor
4918  *
4919  * Different nodes in the AST have different members (i.e. children). This
4920  * method recursively visits children using provided visitor.
4921  *
4922  * \param v Concrete visitor that will be used to recursively visit children
4923  *
4924  * \sa Ast::visit_children for example.
4925  */
4926  void visit_children(visitor::Visitor &v) override;
4927 
4928  /**
4929  * \brief visit children i.e. member variables of current node using provided
4930  * visitor
4931  *
4932  * Different nodes in the AST have different members (i.e. children). This
4933  * method recursively visits children using provided visitor.
4934  *
4935  * \param v Concrete constant visitor that will be used to recursively visit
4936  * children
4937  *
4938  * \sa Ast::visit_children for example.
4939  */
4940  void visit_children(visitor::ConstVisitor &v) const override;
4941 
4942  /**
4943  * \brief accept (or visit) the current AST node using provided visitor
4944  *
4945  * Instead of visiting children of AST node, like Ast::visit_children,
4946  * accept allows to visit the current node itself using provided concrete
4947  * visitor.
4948  *
4949  * \param v Concrete visitor that will be used to recursively visit node
4950  *
4951  * \sa Ast::accept for example.
4952  */
4953  void accept(visitor::Visitor &v) override;
4954 
4955  /**
4956  * \copydoc accept(visitor::Visitor&)
4957  */
4958  void accept(visitor::ConstVisitor &v) const override;
4959 
4960  /// \}
4961 
4962 private:
4963  /**
4964  * \brief Set this object as parent for all the children
4965  *
4966  * This should be called in every object (with children) constructor
4967  * to set parents. Since it is called only in the constructors it
4968  * should not be virtual to avoid ambiguities (issue #295).
4969  */
4970  void set_parent_in_children();
4971 };
4972 
4973 /** @} */ // end of ast_class
4974 
4975 } // namespace ast
4976 } // namespace nmodl
4977 #endif // !NMODL_AST_RANGE_VAR_HPP
4978 #ifndef NMODL_AST_GLOBAL_VAR_HPP
4979 #define NMODL_AST_GLOBAL_VAR_HPP
4980 
4981 namespace nmodl {
4982 namespace ast {
4983 
4984 /**
4985  * @addtogroup ast_class
4986  * @ingroup ast
4987  * @{
4988  */
4989 
4990 /**
4991  * \brief TODO
4992  *
4993  *
4994  */
4995 class GlobalVar : public Identifier {
4996 private:
4997  /// TODO
4998  std::shared_ptr<Name> name;
4999  /// token with location information
5000  std::shared_ptr<ModToken> token;
5001 
5002 public:
5003  /// \name Ctor & dtor
5004  /// \{
5005 
5006  explicit GlobalVar(Name *name);
5007  explicit GlobalVar(const std::shared_ptr<Name> &name);
5008  GlobalVar(const GlobalVar &obj);
5009 
5010  virtual ~GlobalVar() = default;
5011 
5012  /// \}
5013 
5014  /**
5015  * \brief Check if the ast node is an instance of ast::GlobalVar
5016  * \return true as object is of type ast::GlobalVar
5017  */
5018  bool is_global_var() const noexcept override { return true; }
5019 
5020  /**
5021  * \brief Return a copy of the current node
5022  *
5023  * Recursively make a new copy/clone of the current node including
5024  * all members and return a pointer to the node. This is used for
5025  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
5026  * ast.
5027  *
5028  * @return pointer to the clone/copy of the current node
5029  */
5030  GlobalVar *clone() const override { return new GlobalVar(*this); }
5031 
5032  /// \name Getters
5033  /// \{
5034 
5035  /**
5036  * \brief Return type (ast::AstNodeType) of ast node
5037  *
5038  * Every node in the ast has a type defined in ast::AstNodeType and this
5039  * function is used to retrieve the same.
5040  *
5041  * \return ast node type i.e. ast::AstNodeType::GLOBAL_VAR
5042  *
5043  * \sa Ast::get_node_type_name
5044  */
5045  AstNodeType get_node_type() const noexcept override {
5046  return AstNodeType::GLOBAL_VAR;
5047  }
5048 
5049  /**
5050  * \brief Return type (ast::AstNodeType) of ast node as std::string
5051  *
5052  * Every node in the ast has a type defined in ast::AstNodeType.
5053  * This type name can be returned as a std::string for printing
5054  * node to text/json form.
5055  *
5056  * \return name of the node type as a string i.e. "GlobalVar"
5057  *
5058  * \sa Ast::get_node_name
5059  */
5060  std::string get_node_type_name() const noexcept override {
5061  return "GlobalVar";
5062  }
5063 
5064  /**
5065  * \brief Get std::shared_ptr from `this` pointer of the current ast node
5066  */
5067  std::shared_ptr<Ast> get_shared_ptr() override {
5068  return std::static_pointer_cast<GlobalVar>(shared_from_this());
5069  }
5070 
5071  /**
5072  * \brief Get std::shared_ptr from `this` pointer of the current ast node
5073  */
5074  std::shared_ptr<const Ast> get_shared_ptr() const override {
5075  return std::static_pointer_cast<const GlobalVar>(shared_from_this());
5076  }
5077 
5078  /**
5079  * \brief Return associated token for the current ast node
5080  *
5081  * Not all ast nodes have token information. For example,
5082  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
5083  * solution of ODEs. In this case, we return nullptr to store in the
5084  * nmodl::symtab::SymbolTable.
5085  *
5086  * \return pointer to token if exist otherwise nullptr
5087  */
5088  const ModToken *get_token() const noexcept override { return token.get(); }
5089 
5090  /**
5091  * \brief Return name of the node
5092  *
5093  * Some ast nodes have a member marked designated as node name. For example,
5094  * in case of this ast::Name has name designated as a
5095  * node name.
5096  *
5097  * @return name of the node as std::string
5098  *
5099  * \sa Ast::get_node_type_name
5100  */
5101  std::string get_node_name() const override;
5102 
5103  /**
5104  * \brief Getter for member variable \ref GlobalVar.name
5105  */
5106  const std::shared_ptr<Name> &get_name() const noexcept { return name; }
5107 
5108  /// \}
5109 
5110  /// \name Setters
5111  /// \{
5112 
5113  /**
5114  * \brief Set token for the current ast node
5115  */
5116  void set_token(const ModToken &tok) {
5117  token = std::make_shared<ModToken>(tok);
5118  }
5119 
5120  /**
5121  * \brief Setter for member variable \ref GlobalVar.name (rvalue reference)
5122  */
5123  void set_name(std::shared_ptr<Name> &&name);
5124 
5125  /**
5126  * \brief Setter for member variable \ref GlobalVar.name
5127  */
5128  void set_name(const std::shared_ptr<Name> &name);
5129 
5130  /// \}
5131 
5132  /// \name Visitor
5133  /// \{
5134 
5135  /**
5136  * \brief visit children i.e. member variables of current node using provided
5137  * visitor
5138  *
5139  * Different nodes in the AST have different members (i.e. children). This
5140  * method recursively visits children using provided visitor.
5141  *
5142  * \param v Concrete visitor that will be used to recursively visit children
5143  *
5144  * \sa Ast::visit_children for example.
5145  */
5146  void visit_children(visitor::Visitor &v) override;
5147 
5148  /**
5149  * \brief visit children i.e. member variables of current node using provided
5150  * visitor
5151  *
5152  * Different nodes in the AST have different members (i.e. children). This
5153  * method recursively visits children using provided visitor.
5154  *
5155  * \param v Concrete constant visitor that will be used to recursively visit
5156  * children
5157  *
5158  * \sa Ast::visit_children for example.
5159  */
5160  void visit_children(visitor::ConstVisitor &v) const override;
5161 
5162  /**
5163  * \brief accept (or visit) the current AST node using provided visitor
5164  *
5165  * Instead of visiting children of AST node, like Ast::visit_children,
5166  * accept allows to visit the current node itself using provided concrete
5167  * visitor.
5168  *
5169  * \param v Concrete visitor that will be used to recursively visit node
5170  *
5171  * \sa Ast::accept for example.
5172  */
5173  void accept(visitor::Visitor &v) override;
5174 
5175  /**
5176  * \copydoc accept(visitor::Visitor&)
5177  */
5178  void accept(visitor::ConstVisitor &v) const override;
5179 
5180  /// \}
5181 
5182 private:
5183  /**
5184  * \brief Set this object as parent for all the children
5185  *
5186  * This should be called in every object (with children) constructor
5187  * to set parents. Since it is called only in the constructors it
5188  * should not be virtual to avoid ambiguities (issue #295).
5189  */
5190  void set_parent_in_children();
5191 };
5192 
5193 /** @} */ // end of ast_class
5194 
5195 } // namespace ast
5196 } // namespace nmodl
5197 #endif // !NMODL_AST_GLOBAL_VAR_HPP
5198 #ifndef NMODL_AST_POINTER_VAR_HPP
5199 #define NMODL_AST_POINTER_VAR_HPP
5200 
5201 namespace nmodl {
5202 namespace ast {
5203 
5204 /**
5205  * @addtogroup ast_class
5206  * @ingroup ast
5207  * @{
5208  */
5209 
5210 /**
5211  * \brief TODO
5212  *
5213  *
5214  */
5215 class PointerVar : public Identifier {
5216 private:
5217  /// TODO
5218  std::shared_ptr<Name> name;
5219  /// token with location information
5220  std::shared_ptr<ModToken> token;
5221 
5222 public:
5223  /// \name Ctor & dtor
5224  /// \{
5225 
5226  explicit PointerVar(Name *name);
5227  explicit PointerVar(const std::shared_ptr<Name> &name);
5228  PointerVar(const PointerVar &obj);
5229 
5230  virtual ~PointerVar() = default;
5231 
5232  /// \}
5233 
5234  /**
5235  * \brief Check if the ast node is an instance of ast::PointerVar
5236  * \return true as object is of type ast::PointerVar
5237  */
5238  bool is_pointer_var() const noexcept override { return true; }
5239 
5240  /**
5241  * \brief Return a copy of the current node
5242  *
5243  * Recursively make a new copy/clone of the current node including
5244  * all members and return a pointer to the node. This is used for
5245  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
5246  * ast.
5247  *
5248  * @return pointer to the clone/copy of the current node
5249  */
5250  PointerVar *clone() const override { return new PointerVar(*this); }
5251 
5252  /// \name Getters
5253  /// \{
5254 
5255  /**
5256  * \brief Return type (ast::AstNodeType) of ast node
5257  *
5258  * Every node in the ast has a type defined in ast::AstNodeType and this
5259  * function is used to retrieve the same.
5260  *
5261  * \return ast node type i.e. ast::AstNodeType::POINTER_VAR
5262  *
5263  * \sa Ast::get_node_type_name
5264  */
5265  AstNodeType get_node_type() const noexcept override {
5266  return AstNodeType::POINTER_VAR;
5267  }
5268 
5269  /**
5270  * \brief Return type (ast::AstNodeType) of ast node as std::string
5271  *
5272  * Every node in the ast has a type defined in ast::AstNodeType.
5273  * This type name can be returned as a std::string for printing
5274  * node to text/json form.
5275  *
5276  * \return name of the node type as a string i.e. "PointerVar"
5277  *
5278  * \sa Ast::get_node_name
5279  */
5280  std::string get_node_type_name() const noexcept override {
5281  return "PointerVar";
5282  }
5283 
5284  /**
5285  * \brief Get std::shared_ptr from `this` pointer of the current ast node
5286  */
5287  std::shared_ptr<Ast> get_shared_ptr() override {
5288  return std::static_pointer_cast<PointerVar>(shared_from_this());
5289  }
5290 
5291  /**
5292  * \brief Get std::shared_ptr from `this` pointer of the current ast node
5293  */
5294  std::shared_ptr<const Ast> get_shared_ptr() const override {
5295  return std::static_pointer_cast<const PointerVar>(shared_from_this());
5296  }
5297 
5298  /**
5299  * \brief Return associated token for the current ast node
5300  *
5301  * Not all ast nodes have token information. For example,
5302  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
5303  * solution of ODEs. In this case, we return nullptr to store in the
5304  * nmodl::symtab::SymbolTable.
5305  *
5306  * \return pointer to token if exist otherwise nullptr
5307  */
5308  const ModToken *get_token() const noexcept override { return token.get(); }
5309 
5310  /**
5311  * \brief Return name of the node
5312  *
5313  * Some ast nodes have a member marked designated as node name. For example,
5314  * in case of this ast::Name has name designated as a
5315  * node name.
5316  *
5317  * @return name of the node as std::string
5318  *
5319  * \sa Ast::get_node_type_name
5320  */
5321  std::string get_node_name() const override;
5322 
5323  /**
5324  * \brief Getter for member variable \ref PointerVar.name
5325  */
5326  const std::shared_ptr<Name> &get_name() const noexcept { return name; }
5327 
5328  /// \}
5329 
5330  /// \name Setters
5331  /// \{
5332 
5333  /**
5334  * \brief Set token for the current ast node
5335  */
5336  void set_token(const ModToken &tok) {
5337  token = std::make_shared<ModToken>(tok);
5338  }
5339 
5340  /**
5341  * \brief Setter for member variable \ref PointerVar.name (rvalue reference)
5342  */
5343  void set_name(std::shared_ptr<Name> &&name);
5344 
5345  /**
5346  * \brief Setter for member variable \ref PointerVar.name
5347  */
5348  void set_name(const std::shared_ptr<Name> &name);
5349 
5350  /// \}
5351 
5352  /// \name Visitor
5353  /// \{
5354 
5355  /**
5356  * \brief visit children i.e. member variables of current node using provided
5357  * visitor
5358  *
5359  * Different nodes in the AST have different members (i.e. children). This
5360  * method recursively visits children using provided visitor.
5361  *
5362  * \param v Concrete visitor that will be used to recursively visit children
5363  *
5364  * \sa Ast::visit_children for example.
5365  */
5366  void visit_children(visitor::Visitor &v) override;
5367 
5368  /**
5369  * \brief visit children i.e. member variables of current node using provided
5370  * visitor
5371  *
5372  * Different nodes in the AST have different members (i.e. children). This
5373  * method recursively visits children using provided visitor.
5374  *
5375  * \param v Concrete constant visitor that will be used to recursively visit
5376  * children
5377  *
5378  * \sa Ast::visit_children for example.
5379  */
5380  void visit_children(visitor::ConstVisitor &v) const override;
5381 
5382  /**
5383  * \brief accept (or visit) the current AST node using provided visitor
5384  *
5385  * Instead of visiting children of AST node, like Ast::visit_children,
5386  * accept allows to visit the current node itself using provided concrete
5387  * visitor.
5388  *
5389  * \param v Concrete visitor that will be used to recursively visit node
5390  *
5391  * \sa Ast::accept for example.
5392  */
5393  void accept(visitor::Visitor &v) override;
5394 
5395  /**
5396  * \copydoc accept(visitor::Visitor&)
5397  */
5398  void accept(visitor::ConstVisitor &v) const override;
5399 
5400  /// \}
5401 
5402 private:
5403  /**
5404  * \brief Set this object as parent for all the children
5405  *
5406  * This should be called in every object (with children) constructor
5407  * to set parents. Since it is called only in the constructors it
5408  * should not be virtual to avoid ambiguities (issue #295).
5409  */
5410  void set_parent_in_children();
5411 };
5412 
5413 /** @} */ // end of ast_class
5414 
5415 } // namespace ast
5416 } // namespace nmodl
5417 #endif // !NMODL_AST_POINTER_VAR_HPP
5418 #ifndef NMODL_AST_BBCORE_POINTER_VAR_HPP
5419 #define NMODL_AST_BBCORE_POINTER_VAR_HPP
5420 
5421 namespace nmodl {
5422 namespace ast {
5423 
5424 /**
5425  * @addtogroup ast_class
5426  * @ingroup ast
5427  * @{
5428  */
5429 
5430 /**
5431  * \brief Represent a single variable of type BBCOREPOINTER
5432  *
5433  * See ast::BbcorePointer for an example.
5434  *
5435  */
5437 private:
5438  /// Variable name
5439  std::shared_ptr<Name> name;
5440  /// token with location information
5441  std::shared_ptr<ModToken> token;
5442 
5443 public:
5444  /// \name Ctor & dtor
5445  /// \{
5446 
5447  explicit BbcorePointerVar(Name *name);
5448  explicit BbcorePointerVar(const std::shared_ptr<Name> &name);
5449  BbcorePointerVar(const BbcorePointerVar &obj);
5450 
5451  virtual ~BbcorePointerVar() = default;
5452 
5453  /// \}
5454 
5455  /**
5456  * \brief Check if the ast node is an instance of ast::BbcorePointerVar
5457  * \return true as object is of type ast::BbcorePointerVar
5458  */
5459  bool is_bbcore_pointer_var() const noexcept override { return true; }
5460 
5461  /**
5462  * \brief Return a copy of the current node
5463  *
5464  * Recursively make a new copy/clone of the current node including
5465  * all members and return a pointer to the node. This is used for
5466  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
5467  * ast.
5468  *
5469  * @return pointer to the clone/copy of the current node
5470  */
5471  BbcorePointerVar *clone() const override {
5472  return new BbcorePointerVar(*this);
5473  }
5474 
5475  /// \name Getters
5476  /// \{
5477 
5478  /**
5479  * \brief Return type (ast::AstNodeType) of ast node
5480  *
5481  * Every node in the ast has a type defined in ast::AstNodeType and this
5482  * function is used to retrieve the same.
5483  *
5484  * \return ast node type i.e. ast::AstNodeType::BBCORE_POINTER_VAR
5485  *
5486  * \sa Ast::get_node_type_name
5487  */
5488  AstNodeType get_node_type() const noexcept override {
5490  }
5491 
5492  /**
5493  * \brief Return type (ast::AstNodeType) of ast node as std::string
5494  *
5495  * Every node in the ast has a type defined in ast::AstNodeType.
5496  * This type name can be returned as a std::string for printing
5497  * node to text/json form.
5498  *
5499  * \return name of the node type as a string i.e. "BbcorePointerVar"
5500  *
5501  * \sa Ast::get_node_name
5502  */
5503  std::string get_node_type_name() const noexcept override {
5504  return "BbcorePointerVar";
5505  }
5506 
5507  /**
5508  * \brief Get std::shared_ptr from `this` pointer of the current ast node
5509  */
5510  std::shared_ptr<Ast> get_shared_ptr() override {
5511  return std::static_pointer_cast<BbcorePointerVar>(shared_from_this());
5512  }
5513 
5514  /**
5515  * \brief Get std::shared_ptr from `this` pointer of the current ast node
5516  */
5517  std::shared_ptr<const Ast> get_shared_ptr() const override {
5518  return std::static_pointer_cast<const BbcorePointerVar>(shared_from_this());
5519  }
5520 
5521  /**
5522  * \brief Return associated token for the current ast node
5523  *
5524  * Not all ast nodes have token information. For example,
5525  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
5526  * solution of ODEs. In this case, we return nullptr to store in the
5527  * nmodl::symtab::SymbolTable.
5528  *
5529  * \return pointer to token if exist otherwise nullptr
5530  */
5531  const ModToken *get_token() const noexcept override { return token.get(); }
5532 
5533  /**
5534  * \brief Return name of the node
5535  *
5536  * Some ast nodes have a member marked designated as node name. For example,
5537  * in case of this ast::Name has name designated as a
5538  * node name.
5539  *
5540  * @return name of the node as std::string
5541  *
5542  * \sa Ast::get_node_type_name
5543  */
5544  std::string get_node_name() const override;
5545 
5546  /**
5547  * \brief Getter for member variable \ref BbcorePointerVar.name
5548  */
5549  const std::shared_ptr<Name> &get_name() const noexcept { return name; }
5550 
5551  /// \}
5552 
5553  /// \name Setters
5554  /// \{
5555 
5556  /**
5557  * \brief Set token for the current ast node
5558  */
5559  void set_token(const ModToken &tok) {
5560  token = std::make_shared<ModToken>(tok);
5561  }
5562 
5563  /**
5564  * \brief Setter for member variable \ref BbcorePointerVar.name (rvalue
5565  * reference)
5566  */
5567  void set_name(std::shared_ptr<Name> &&name);
5568 
5569  /**
5570  * \brief Setter for member variable \ref BbcorePointerVar.name
5571  */
5572  void set_name(const std::shared_ptr<Name> &name);
5573 
5574  /// \}
5575 
5576  /// \name Visitor
5577  /// \{
5578 
5579  /**
5580  * \brief visit children i.e. member variables of current node using provided
5581  * visitor
5582  *
5583  * Different nodes in the AST have different members (i.e. children). This
5584  * method recursively visits children using provided visitor.
5585  *
5586  * \param v Concrete visitor that will be used to recursively visit children
5587  *
5588  * \sa Ast::visit_children for example.
5589  */
5590  void visit_children(visitor::Visitor &v) override;
5591 
5592  /**
5593  * \brief visit children i.e. member variables of current node using provided
5594  * visitor
5595  *
5596  * Different nodes in the AST have different members (i.e. children). This
5597  * method recursively visits children using provided visitor.
5598  *
5599  * \param v Concrete constant visitor that will be used to recursively visit
5600  * children
5601  *
5602  * \sa Ast::visit_children for example.
5603  */
5604  void visit_children(visitor::ConstVisitor &v) const override;
5605 
5606  /**
5607  * \brief accept (or visit) the current AST node using provided visitor
5608  *
5609  * Instead of visiting children of AST node, like Ast::visit_children,
5610  * accept allows to visit the current node itself using provided concrete
5611  * visitor.
5612  *
5613  * \param v Concrete visitor that will be used to recursively visit node
5614  *
5615  * \sa Ast::accept for example.
5616  */
5617  void accept(visitor::Visitor &v) override;
5618 
5619  /**
5620  * \copydoc accept(visitor::Visitor&)
5621  */
5622  void accept(visitor::ConstVisitor &v) const override;
5623 
5624  /// \}
5625 
5626 private:
5627  /**
5628  * \brief Set this object as parent for all the children
5629  *
5630  * This should be called in every object (with children) constructor
5631  * to set parents. Since it is called only in the constructors it
5632  * should not be virtual to avoid ambiguities (issue #295).
5633  */
5634  void set_parent_in_children();
5635 };
5636 
5637 /** @} */ // end of ast_class
5638 
5639 } // namespace ast
5640 } // namespace nmodl
5641 #endif // !NMODL_AST_BBCORE_POINTER_VAR_HPP
5642 #ifndef NMODL_AST_EXTERN_VAR_HPP
5643 #define NMODL_AST_EXTERN_VAR_HPP
5644 
5645 namespace nmodl {
5646 namespace ast {
5647 
5648 /**
5649  * @addtogroup ast_class
5650  * @ingroup ast
5651  * @{
5652  */
5653 
5654 /**
5655  * \brief TODO
5656  *
5657  *
5658  */
5659 class ExternVar : public Identifier {
5660 private:
5661  /// TODO
5662  std::shared_ptr<Name> name;
5663  /// token with location information
5664  std::shared_ptr<ModToken> token;
5665 
5666 public:
5667  /// \name Ctor & dtor
5668  /// \{
5669 
5670  explicit ExternVar(Name *name);
5671  explicit ExternVar(const std::shared_ptr<Name> &name);
5672  ExternVar(const ExternVar &obj);
5673 
5674  virtual ~ExternVar() = default;
5675 
5676  /// \}
5677 
5678  /**
5679  * \brief Check if the ast node is an instance of ast::ExternVar
5680  * \return true as object is of type ast::ExternVar
5681  */
5682  bool is_extern_var() const noexcept override { return true; }
5683 
5684  /**
5685  * \brief Return a copy of the current node
5686  *
5687  * Recursively make a new copy/clone of the current node including
5688  * all members and return a pointer to the node. This is used for
5689  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
5690  * ast.
5691  *
5692  * @return pointer to the clone/copy of the current node
5693  */
5694  ExternVar *clone() const override { return new ExternVar(*this); }
5695 
5696  /// \name Getters
5697  /// \{
5698 
5699  /**
5700  * \brief Return type (ast::AstNodeType) of ast node
5701  *
5702  * Every node in the ast has a type defined in ast::AstNodeType and this
5703  * function is used to retrieve the same.
5704  *
5705  * \return ast node type i.e. ast::AstNodeType::EXTERN_VAR
5706  *
5707  * \sa Ast::get_node_type_name
5708  */
5709  AstNodeType get_node_type() const noexcept override {
5710  return AstNodeType::EXTERN_VAR;
5711  }
5712 
5713  /**
5714  * \brief Return type (ast::AstNodeType) of ast node as std::string
5715  *
5716  * Every node in the ast has a type defined in ast::AstNodeType.
5717  * This type name can be returned as a std::string for printing
5718  * node to text/json form.
5719  *
5720  * \return name of the node type as a string i.e. "ExternVar"
5721  *
5722  * \sa Ast::get_node_name
5723  */
5724  std::string get_node_type_name() const noexcept override {
5725  return "ExternVar";
5726  }
5727 
5728  /**
5729  * \brief Get std::shared_ptr from `this` pointer of the current ast node
5730  */
5731  std::shared_ptr<Ast> get_shared_ptr() override {
5732  return std::static_pointer_cast<ExternVar>(shared_from_this());
5733  }
5734 
5735  /**
5736  * \brief Get std::shared_ptr from `this` pointer of the current ast node
5737  */
5738  std::shared_ptr<const Ast> get_shared_ptr() const override {
5739  return std::static_pointer_cast<const ExternVar>(shared_from_this());
5740  }
5741 
5742  /**
5743  * \brief Return associated token for the current ast node
5744  *
5745  * Not all ast nodes have token information. For example,
5746  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
5747  * solution of ODEs. In this case, we return nullptr to store in the
5748  * nmodl::symtab::SymbolTable.
5749  *
5750  * \return pointer to token if exist otherwise nullptr
5751  */
5752  const ModToken *get_token() const noexcept override { return token.get(); }
5753 
5754  /**
5755  * \brief Return name of the node
5756  *
5757  * Some ast nodes have a member marked designated as node name. For example,
5758  * in case of this ast::Name has name designated as a
5759  * node name.
5760  *
5761  * @return name of the node as std::string
5762  *
5763  * \sa Ast::get_node_type_name
5764  */
5765  std::string get_node_name() const override;
5766 
5767  /**
5768  * \brief Getter for member variable \ref ExternVar.name
5769  */
5770  const std::shared_ptr<Name> &get_name() const noexcept { return name; }
5771 
5772  /// \}
5773 
5774  /// \name Setters
5775  /// \{
5776 
5777  /**
5778  * \brief Set token for the current ast node
5779  */
5780  void set_token(const ModToken &tok) {
5781  token = std::make_shared<ModToken>(tok);
5782  }
5783 
5784  /**
5785  * \brief Setter for member variable \ref ExternVar.name (rvalue reference)
5786  */
5787  void set_name(std::shared_ptr<Name> &&name);
5788 
5789  /**
5790  * \brief Setter for member variable \ref ExternVar.name
5791  */
5792  void set_name(const std::shared_ptr<Name> &name);
5793 
5794  /// \}
5795 
5796  /// \name Visitor
5797  /// \{
5798 
5799  /**
5800  * \brief visit children i.e. member variables of current node using provided
5801  * visitor
5802  *
5803  * Different nodes in the AST have different members (i.e. children). This
5804  * method recursively visits children using provided visitor.
5805  *
5806  * \param v Concrete visitor that will be used to recursively visit children
5807  *
5808  * \sa Ast::visit_children for example.
5809  */
5810  void visit_children(visitor::Visitor &v) override;
5811 
5812  /**
5813  * \brief visit children i.e. member variables of current node using provided
5814  * visitor
5815  *
5816  * Different nodes in the AST have different members (i.e. children). This
5817  * method recursively visits children using provided visitor.
5818  *
5819  * \param v Concrete constant visitor that will be used to recursively visit
5820  * children
5821  *
5822  * \sa Ast::visit_children for example.
5823  */
5824  void visit_children(visitor::ConstVisitor &v) const override;
5825 
5826  /**
5827  * \brief accept (or visit) the current AST node using provided visitor
5828  *
5829  * Instead of visiting children of AST node, like Ast::visit_children,
5830  * accept allows to visit the current node itself using provided concrete
5831  * visitor.
5832  *
5833  * \param v Concrete visitor that will be used to recursively visit node
5834  *
5835  * \sa Ast::accept for example.
5836  */
5837  void accept(visitor::Visitor &v) override;
5838 
5839  /**
5840  * \copydoc accept(visitor::Visitor&)
5841  */
5842  void accept(visitor::ConstVisitor &v) const override;
5843 
5844  /// \}
5845 
5846 private:
5847  /**
5848  * \brief Set this object as parent for all the children
5849  *
5850  * This should be called in every object (with children) constructor
5851  * to set parents. Since it is called only in the constructors it
5852  * should not be virtual to avoid ambiguities (issue #295).
5853  */
5854  void set_parent_in_children();
5855 };
5856 
5857 /** @} */ // end of ast_class
5858 
5859 } // namespace ast
5860 } // namespace nmodl
5861 #endif // !NMODL_AST_EXTERN_VAR_HPP
5862 #ifndef NMODL_AST_THREADSAFE_VAR_HPP
5863 #define NMODL_AST_THREADSAFE_VAR_HPP
5864 
5865 namespace nmodl {
5866 namespace ast {
5867 
5868 /**
5869  * @addtogroup ast_class
5870  * @ingroup ast
5871  * @{
5872  */
5873 
5874 /**
5875  * \brief TODO
5876  *
5877  *
5878  */
5879 class ThreadsafeVar : public Identifier {
5880 private:
5881  /// TODO
5882  std::shared_ptr<Name> name;
5883  /// token with location information
5884  std::shared_ptr<ModToken> token;
5885 
5886 public:
5887  /// \name Ctor & dtor
5888  /// \{
5889 
5890  explicit ThreadsafeVar(Name *name);
5891  explicit ThreadsafeVar(const std::shared_ptr<Name> &name);
5892  ThreadsafeVar(const ThreadsafeVar &obj);
5893 
5894  virtual ~ThreadsafeVar() = default;
5895 
5896  /// \}
5897 
5898  /**
5899  * \brief Check if the ast node is an instance of ast::ThreadsafeVar
5900  * \return true as object is of type ast::ThreadsafeVar
5901  */
5902  bool is_threadsafe_var() const noexcept override { return true; }
5903 
5904  /**
5905  * \brief Return a copy of the current node
5906  *
5907  * Recursively make a new copy/clone of the current node including
5908  * all members and return a pointer to the node. This is used for
5909  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
5910  * ast.
5911  *
5912  * @return pointer to the clone/copy of the current node
5913  */
5914  ThreadsafeVar *clone() const override { return new ThreadsafeVar(*this); }
5915 
5916  /// \name Getters
5917  /// \{
5918 
5919  /**
5920  * \brief Return type (ast::AstNodeType) of ast node
5921  *
5922  * Every node in the ast has a type defined in ast::AstNodeType and this
5923  * function is used to retrieve the same.
5924  *
5925  * \return ast node type i.e. ast::AstNodeType::THREADSAFE_VAR
5926  *
5927  * \sa Ast::get_node_type_name
5928  */
5929  AstNodeType get_node_type() const noexcept override {
5931  }
5932 
5933  /**
5934  * \brief Return type (ast::AstNodeType) of ast node as std::string
5935  *
5936  * Every node in the ast has a type defined in ast::AstNodeType.
5937  * This type name can be returned as a std::string for printing
5938  * node to text/json form.
5939  *
5940  * \return name of the node type as a string i.e. "ThreadsafeVar"
5941  *
5942  * \sa Ast::get_node_name
5943  */
5944  std::string get_node_type_name() const noexcept override {
5945  return "ThreadsafeVar";
5946  }
5947 
5948  /**
5949  * \brief Get std::shared_ptr from `this` pointer of the current ast node
5950  */
5951  std::shared_ptr<Ast> get_shared_ptr() override {
5952  return std::static_pointer_cast<ThreadsafeVar>(shared_from_this());
5953  }
5954 
5955  /**
5956  * \brief Get std::shared_ptr from `this` pointer of the current ast node
5957  */
5958  std::shared_ptr<const Ast> get_shared_ptr() const override {
5959  return std::static_pointer_cast<const ThreadsafeVar>(shared_from_this());
5960  }
5961 
5962  /**
5963  * \brief Return associated token for the current ast node
5964  *
5965  * Not all ast nodes have token information. For example,
5966  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
5967  * solution of ODEs. In this case, we return nullptr to store in the
5968  * nmodl::symtab::SymbolTable.
5969  *
5970  * \return pointer to token if exist otherwise nullptr
5971  */
5972  const ModToken *get_token() const noexcept override { return token.get(); }
5973 
5974  /**
5975  * \brief Return name of the node
5976  *
5977  * Some ast nodes have a member marked designated as node name. For example,
5978  * in case of this ast::Name has name designated as a
5979  * node name.
5980  *
5981  * @return name of the node as std::string
5982  *
5983  * \sa Ast::get_node_type_name
5984  */
5985  std::string get_node_name() const override;
5986 
5987  /**
5988  * \brief Getter for member variable \ref ThreadsafeVar.name
5989  */
5990  const std::shared_ptr<Name> &get_name() const noexcept { return name; }
5991 
5992  /// \}
5993 
5994  /// \name Setters
5995  /// \{
5996 
5997  /**
5998  * \brief Set token for the current ast node
5999  */
6000  void set_token(const ModToken &tok) {
6001  token = std::make_shared<ModToken>(tok);
6002  }
6003 
6004  /**
6005  * \brief Setter for member variable \ref ThreadsafeVar.name (rvalue
6006  * reference)
6007  */
6008  void set_name(std::shared_ptr<Name> &&name);
6009 
6010  /**
6011  * \brief Setter for member variable \ref ThreadsafeVar.name
6012  */
6013  void set_name(const std::shared_ptr<Name> &name);
6014 
6015  /// \}
6016 
6017  /// \name Visitor
6018  /// \{
6019 
6020  /**
6021  * \brief visit children i.e. member variables of current node using provided
6022  * visitor
6023  *
6024  * Different nodes in the AST have different members (i.e. children). This
6025  * method recursively visits children using provided visitor.
6026  *
6027  * \param v Concrete visitor that will be used to recursively visit children
6028  *
6029  * \sa Ast::visit_children for example.
6030  */
6031  void visit_children(visitor::Visitor &v) override;
6032 
6033  /**
6034  * \brief visit children i.e. member variables of current node using provided
6035  * visitor
6036  *
6037  * Different nodes in the AST have different members (i.e. children). This
6038  * method recursively visits children using provided visitor.
6039  *
6040  * \param v Concrete constant visitor that will be used to recursively visit
6041  * children
6042  *
6043  * \sa Ast::visit_children for example.
6044  */
6045  void visit_children(visitor::ConstVisitor &v) const override;
6046 
6047  /**
6048  * \brief accept (or visit) the current AST node using provided visitor
6049  *
6050  * Instead of visiting children of AST node, like Ast::visit_children,
6051  * accept allows to visit the current node itself using provided concrete
6052  * visitor.
6053  *
6054  * \param v Concrete visitor that will be used to recursively visit node
6055  *
6056  * \sa Ast::accept for example.
6057  */
6058  void accept(visitor::Visitor &v) override;
6059 
6060  /**
6061  * \copydoc accept(visitor::Visitor&)
6062  */
6063  void accept(visitor::ConstVisitor &v) const override;
6064 
6065  /// \}
6066 
6067 private:
6068  /**
6069  * \brief Set this object as parent for all the children
6070  *
6071  * This should be called in every object (with children) constructor
6072  * to set parents. Since it is called only in the constructors it
6073  * should not be virtual to avoid ambiguities (issue #295).
6074  */
6075  void set_parent_in_children();
6076 };
6077 
6078 /** @} */ // end of ast_class
6079 
6080 } // namespace ast
6081 } // namespace nmodl
6082 #endif // !NMODL_AST_THREADSAFE_VAR_HPP
6083 #ifndef NMODL_AST_PARAM_BLOCK_HPP
6084 #define NMODL_AST_PARAM_BLOCK_HPP
6085 
6086 namespace nmodl {
6087 namespace ast {
6088 
6089 /**
6090  * @addtogroup ast_class
6091  * @ingroup ast
6092  * @{
6093  */
6094 
6095 /**
6096  * \brief Represents a `PARAMETER` block in the NMODL
6097  *
6098  * Variables whose values are normally specified by the user are parameters
6099  * and are declared in a `PARAMETER` block. Here is an example :
6100  *
6101  * \code{.mod}
6102  * PARAMETER {
6103  * gkbar=.01 (mho/cm2) : Maximum Permeability
6104  * d1 = .84
6105  * k2 = .13e-6 (mM)
6106  * abar = .28 (/ms)
6107  * lcai (mV)
6108  * }
6109  * \endcode
6110  *
6111  * All parameters are stored in the ast::ParamBlock::statements as vector.
6112  *
6113  */
6114 class ParamBlock : public Block {
6115 private:
6116  /// Vector of parameters
6118  /// token with location information
6119  std::shared_ptr<ModToken> token;
6120  /// symbol table for a block
6121  symtab::SymbolTable *symtab = nullptr;
6122 
6123 public:
6124  /// \name Ctor & dtor
6125  /// \{
6126 
6127  explicit ParamBlock(ParamAssignVector statements);
6128  ParamBlock(const ParamBlock &obj);
6129 
6130  virtual ~ParamBlock() = default;
6131 
6132  /// \}
6133 
6134  /**
6135  * \brief Check if the ast node is an instance of ast::ParamBlock
6136  * \return true as object is of type ast::ParamBlock
6137  */
6138  bool is_param_block() const noexcept override { return true; }
6139 
6140  /**
6141  * \brief Return a copy of the current node
6142  *
6143  * Recursively make a new copy/clone of the current node including
6144  * all members and return a pointer to the node. This is used for
6145  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
6146  * ast.
6147  *
6148  * @return pointer to the clone/copy of the current node
6149  */
6150  ParamBlock *clone() const override { return new ParamBlock(*this); }
6151 
6152  /// \name Getters
6153  /// \{
6154 
6155  /**
6156  * \brief Return type (ast::AstNodeType) of ast node
6157  *
6158  * Every node in the ast has a type defined in ast::AstNodeType and this
6159  * function is used to retrieve the same.
6160  *
6161  * \return ast node type i.e. ast::AstNodeType::PARAM_BLOCK
6162  *
6163  * \sa Ast::get_node_type_name
6164  */
6165  AstNodeType get_node_type() const noexcept override {
6166  return AstNodeType::PARAM_BLOCK;
6167  }
6168 
6169  /**
6170  * \brief Return type (ast::AstNodeType) of ast node as std::string
6171  *
6172  * Every node in the ast has a type defined in ast::AstNodeType.
6173  * This type name can be returned as a std::string for printing
6174  * node to text/json form.
6175  *
6176  * \return name of the node type as a string i.e. "ParamBlock"
6177  *
6178  * \sa Ast::get_node_name
6179  */
6180  std::string get_node_type_name() const noexcept override {
6181  return "ParamBlock";
6182  }
6183 
6184  /**
6185  * \brief Return NMODL statement of ast node as std::string
6186  *
6187  * Every node is related to a special statement in the NMODL. This
6188  * statement can be returned as a std::string for printing to
6189  * text/json form.
6190  *
6191  * \return name of the statement as a string i.e. "PARAMETER "
6192  *
6193  * \sa Ast::get_nmodl_name
6194  */
6195  std::string get_nmodl_name() const noexcept override { return "PARAMETER "; }
6196 
6197  /**
6198  * \brief Get std::shared_ptr from `this` pointer of the current ast node
6199  */
6200  std::shared_ptr<Ast> get_shared_ptr() override {
6201  return std::static_pointer_cast<ParamBlock>(shared_from_this());
6202  }
6203 
6204  /**
6205  * \brief Get std::shared_ptr from `this` pointer of the current ast node
6206  */
6207  std::shared_ptr<const Ast> get_shared_ptr() const override {
6208  return std::static_pointer_cast<const ParamBlock>(shared_from_this());
6209  }
6210 
6211  /**
6212  * \brief Return associated token for the current ast node
6213  *
6214  * Not all ast nodes have token information. For example,
6215  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
6216  * solution of ODEs. In this case, we return nullptr to store in the
6217  * nmodl::symtab::SymbolTable.
6218  *
6219  * \return pointer to token if exist otherwise nullptr
6220  */
6221  const ModToken *get_token() const noexcept override { return token.get(); }
6222 
6223  /**
6224  * \brief Return associated symbol table for the current ast node
6225  *
6226  * Only certain ast nodes (e.g. inherited from ast::Block) have associated
6227  * symbol table. These nodes have nmodl::symtab::SymbolTable as member
6228  * and it can be accessed using this method.
6229  *
6230  * \return pointer to the symbol table
6231  *
6232  * \sa nmodl::symtab::SymbolTable nmodl::visitor::SymtabVisitor
6233  */
6234  symtab::SymbolTable *get_symbol_table() const override { return symtab; }
6235 
6236  /**
6237  * \brief Getter for member variable \ref ParamBlock.statements
6238  */
6239  const ParamAssignVector &get_statements() const noexcept {
6240  return statements;
6241  }
6242 
6243  /// \}
6244 
6245  /// \name Setters
6246  /// \{
6247 
6248  /**
6249  * \brief Set token for the current ast node
6250  */
6251  void set_token(const ModToken &tok) {
6252  token = std::make_shared<ModToken>(tok);
6253  }
6254 
6255  /**
6256  * \brief Set symbol table for the current ast node
6257  *
6258  * Top level, block scoped nodes store symbol table in the ast node.
6259  * nmodl::visitor::SymtabVisitor then used this method to setup symbol table
6260  * for every node in the ast.
6261  *
6262  * \sa nmodl::visitor::SymtabVisitor
6263  */
6264  void set_symbol_table(symtab::SymbolTable *newsymtab) override {
6265  symtab = newsymtab;
6266  }
6267 
6268  /**
6269  * \brief Setter for member variable \ref ParamBlock.statements (rvalue
6270  * reference)
6271  */
6272  void set_statements(ParamAssignVector &&statements);
6273 
6274  /**
6275  * \brief Setter for member variable \ref ParamBlock.statements
6276  */
6277  void set_statements(const ParamAssignVector &statements);
6278 
6279  /// \}
6280 
6281  /// \name Visitor
6282  /// \{
6283 
6284  /**
6285  * \brief visit children i.e. member variables of current node using provided
6286  * visitor
6287  *
6288  * Different nodes in the AST have different members (i.e. children). This
6289  * method recursively visits children using provided visitor.
6290  *
6291  * \param v Concrete visitor that will be used to recursively visit children
6292  *
6293  * \sa Ast::visit_children for example.
6294  */
6295  void visit_children(visitor::Visitor &v) override;
6296 
6297  /**
6298  * \brief visit children i.e. member variables of current node using provided
6299  * visitor
6300  *
6301  * Different nodes in the AST have different members (i.e. children). This
6302  * method recursively visits children using provided visitor.
6303  *
6304  * \param v Concrete constant visitor that will be used to recursively visit
6305  * children
6306  *
6307  * \sa Ast::visit_children for example.
6308  */
6309  void visit_children(visitor::ConstVisitor &v) const override;
6310 
6311  /**
6312  * \brief accept (or visit) the current AST node using provided visitor
6313  *
6314  * Instead of visiting children of AST node, like Ast::visit_children,
6315  * accept allows to visit the current node itself using provided concrete
6316  * visitor.
6317  *
6318  * \param v Concrete visitor that will be used to recursively visit node
6319  *
6320  * \sa Ast::accept for example.
6321  */
6322  void accept(visitor::Visitor &v) override;
6323 
6324  /**
6325  * \copydoc accept(visitor::Visitor&)
6326  */
6327  void accept(visitor::ConstVisitor &v) const override;
6328 
6329  /// \}
6330 
6331 private:
6332  /**
6333  * \brief Set this object as parent for all the children
6334  *
6335  * This should be called in every object (with children) constructor
6336  * to set parents. Since it is called only in the constructors it
6337  * should not be virtual to avoid ambiguities (issue #295).
6338  */
6339  void set_parent_in_children();
6340 };
6341 
6342 /** @} */ // end of ast_class
6343 
6344 } // namespace ast
6345 } // namespace nmodl
6346 #endif // !NMODL_AST_PARAM_BLOCK_HPP
6347 #ifndef NMODL_AST_STEP_BLOCK_HPP
6348 #define NMODL_AST_STEP_BLOCK_HPP
6349 
6350 namespace nmodl {
6351 namespace ast {
6352 
6353 /**
6354  * @addtogroup ast_class
6355  * @ingroup ast
6356  * @{
6357  */
6358 
6359 /**
6360  * \brief Represents a `STEPPED` block in the NMODL
6361  *
6362  * `STEPPED` has following form in the NMODL specification :
6363  *
6364  * \code{.mod}
6365  * STEPPED {
6366  * name1 = number1 (mM)
6367  * name2 = number2, number3
6368  * }
6369  * \endcode
6370  *
6371  * \todo Check ModelDB and other databse for example of channel.
6372  *
6373  */
6374 class StepBlock : public Block {
6375 private:
6376  /// Vector of statements
6378  /// token with location information
6379  std::shared_ptr<ModToken> token;
6380  /// symbol table for a block
6381  symtab::SymbolTable *symtab = nullptr;
6382 
6383 public:
6384  /// \name Ctor & dtor
6385  /// \{
6386 
6387  explicit StepBlock(SteppedVector statements);
6388  StepBlock(const StepBlock &obj);
6389 
6390  virtual ~StepBlock() = default;
6391 
6392  /// \}
6393 
6394  /**
6395  * \brief Check if the ast node is an instance of ast::StepBlock
6396  * \return true as object is of type ast::StepBlock
6397  */
6398  bool is_step_block() const noexcept override { return true; }
6399 
6400  /**
6401  * \brief Return a copy of the current node
6402  *
6403  * Recursively make a new copy/clone of the current node including
6404  * all members and return a pointer to the node. This is used for
6405  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
6406  * ast.
6407  *
6408  * @return pointer to the clone/copy of the current node
6409  */
6410  StepBlock *clone() const override { return new StepBlock(*this); }
6411 
6412  /// \name Getters
6413  /// \{
6414 
6415  /**
6416  * \brief Return type (ast::AstNodeType) of ast node
6417  *
6418  * Every node in the ast has a type defined in ast::AstNodeType and this
6419  * function is used to retrieve the same.
6420  *
6421  * \return ast node type i.e. ast::AstNodeType::STEP_BLOCK
6422  *
6423  * \sa Ast::get_node_type_name
6424  */
6425  AstNodeType get_node_type() const noexcept override {
6426  return AstNodeType::STEP_BLOCK;
6427  }
6428 
6429  /**
6430  * \brief Return type (ast::AstNodeType) of ast node as std::string
6431  *
6432  * Every node in the ast has a type defined in ast::AstNodeType.
6433  * This type name can be returned as a std::string for printing
6434  * node to text/json form.
6435  *
6436  * \return name of the node type as a string i.e. "StepBlock"
6437  *
6438  * \sa Ast::get_node_name
6439  */
6440  std::string get_node_type_name() const noexcept override {
6441  return "StepBlock";
6442  }
6443 
6444  /**
6445  * \brief Return NMODL statement of ast node as std::string
6446  *
6447  * Every node is related to a special statement in the NMODL. This
6448  * statement can be returned as a std::string for printing to
6449  * text/json form.
6450  *
6451  * \return name of the statement as a string i.e. "STEPPED "
6452  *
6453  * \sa Ast::get_nmodl_name
6454  */
6455  std::string get_nmodl_name() const noexcept override { return "STEPPED "; }
6456 
6457  /**
6458  * \brief Get std::shared_ptr from `this` pointer of the current ast node
6459  */
6460  std::shared_ptr<Ast> get_shared_ptr() override {
6461  return std::static_pointer_cast<StepBlock>(shared_from_this());
6462  }
6463 
6464  /**
6465  * \brief Get std::shared_ptr from `this` pointer of the current ast node
6466  */
6467  std::shared_ptr<const Ast> get_shared_ptr() const override {
6468  return std::static_pointer_cast<const StepBlock>(shared_from_this());
6469  }
6470 
6471  /**
6472  * \brief Return associated token for the current ast node
6473  *
6474  * Not all ast nodes have token information. For example,
6475  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
6476  * solution of ODEs. In this case, we return nullptr to store in the
6477  * nmodl::symtab::SymbolTable.
6478  *
6479  * \return pointer to token if exist otherwise nullptr
6480  */
6481  const ModToken *get_token() const noexcept override { return token.get(); }
6482 
6483  /**
6484  * \brief Return associated symbol table for the current ast node
6485  *
6486  * Only certain ast nodes (e.g. inherited from ast::Block) have associated
6487  * symbol table. These nodes have nmodl::symtab::SymbolTable as member
6488  * and it can be accessed using this method.
6489  *
6490  * \return pointer to the symbol table
6491  *
6492  * \sa nmodl::symtab::SymbolTable nmodl::visitor::SymtabVisitor
6493  */
6494  symtab::SymbolTable *get_symbol_table() const override { return symtab; }
6495 
6496  /**
6497  * \brief Getter for member variable \ref StepBlock.statements
6498  */
6499  const SteppedVector &get_statements() const noexcept { return statements; }
6500 
6501  /// \}
6502 
6503  /// \name Setters
6504  /// \{
6505 
6506  /**
6507  * \brief Set token for the current ast node
6508  */
6509  void set_token(const ModToken &tok) {
6510  token = std::make_shared<ModToken>(tok);
6511  }
6512 
6513  /**
6514  * \brief Set symbol table for the current ast node
6515  *
6516  * Top level, block scoped nodes store symbol table in the ast node.
6517  * nmodl::visitor::SymtabVisitor then used this method to setup symbol table
6518  * for every node in the ast.
6519  *
6520  * \sa nmodl::visitor::SymtabVisitor
6521  */
6522  void set_symbol_table(symtab::SymbolTable *newsymtab) override {
6523  symtab = newsymtab;
6524  }
6525 
6526  /**
6527  * \brief Setter for member variable \ref StepBlock.statements (rvalue
6528  * reference)
6529  */
6530  void set_statements(SteppedVector &&statements);
6531 
6532  /**
6533  * \brief Setter for member variable \ref StepBlock.statements
6534  */
6535  void set_statements(const SteppedVector &statements);
6536 
6537  /// \}
6538 
6539  /// \name Visitor
6540  /// \{
6541 
6542  /**
6543  * \brief visit children i.e. member variables of current node using provided
6544  * visitor
6545  *
6546  * Different nodes in the AST have different members (i.e. children). This
6547  * method recursively visits children using provided visitor.
6548  *
6549  * \param v Concrete visitor that will be used to recursively visit children
6550  *
6551  * \sa Ast::visit_children for example.
6552  */
6553  void visit_children(visitor::Visitor &v) override;
6554 
6555  /**
6556  * \brief visit children i.e. member variables of current node using provided
6557  * visitor
6558  *
6559  * Different nodes in the AST have different members (i.e. children). This
6560  * method recursively visits children using provided visitor.
6561  *
6562  * \param v Concrete constant visitor that will be used to recursively visit
6563  * children
6564  *
6565  * \sa Ast::visit_children for example.
6566  */
6567  void visit_children(visitor::ConstVisitor &v) const override;
6568 
6569  /**
6570  * \brief accept (or visit) the current AST node using provided visitor
6571  *
6572  * Instead of visiting children of AST node, like Ast::visit_children,
6573  * accept allows to visit the current node itself using provided concrete
6574  * visitor.
6575  *
6576  * \param v Concrete visitor that will be used to recursively visit node
6577  *
6578  * \sa Ast::accept for example.
6579  */
6580  void accept(visitor::Visitor &v) override;
6581 
6582  /**
6583  * \copydoc accept(visitor::Visitor&)
6584  */
6585  void accept(visitor::ConstVisitor &v) const override;
6586 
6587  /// \}
6588 
6589 private:
6590  /**
6591  * \brief Set this object as parent for all the children
6592  *
6593  * This should be called in every object (with children) constructor
6594  * to set parents. Since it is called only in the constructors it
6595  * should not be virtual to avoid ambiguities (issue #295).
6596  */
6597  void set_parent_in_children();
6598 };
6599 
6600 /** @} */ // end of ast_class
6601 
6602 } // namespace ast
6603 } // namespace nmodl
6604 #endif // !NMODL_AST_STEP_BLOCK_HPP
6605 #ifndef NMODL_AST_INDEPENDENT_BLOCK_HPP
6606 #define NMODL_AST_INDEPENDENT_BLOCK_HPP
6607 
6608 namespace nmodl {
6609 namespace ast {
6610 
6611 /**
6612  * @addtogroup ast_class
6613  * @ingroup ast
6614  * @{
6615  */
6616 
6617 /**
6618  * \brief Represents a `INDEPENDENT` block in the NMODL
6619  *
6620  * `INDEPENDENT` has following form in the NMODL specification :
6621  *
6622  * \code{.mod}
6623  * INDEPENDENT {
6624  * t FROM 0 TO 1 WITH 1 (ms)
6625  * }
6626  * \endcode
6627  *
6628  */
6629 class IndependentBlock : public Block {
6630 private:
6631  /// TODO
6633  /// token with location information
6634  std::shared_ptr<ModToken> token;
6635  /// symbol table for a block
6636  symtab::SymbolTable *symtab = nullptr;
6637 
6638 public:
6639  /// \name Ctor & dtor
6640  /// \{
6641 
6642  explicit IndependentBlock(IndependentDefinitionVector definitions);
6643  IndependentBlock(const IndependentBlock &obj);
6644 
6645  virtual ~IndependentBlock() = default;
6646 
6647  /// \}
6648 
6649  /**
6650  * \brief Check if the ast node is an instance of ast::IndependentBlock
6651  * \return true as object is of type ast::IndependentBlock
6652  */
6653  bool is_independent_block() const noexcept override { return true; }
6654 
6655  /**
6656  * \brief Return a copy of the current node
6657  *
6658  * Recursively make a new copy/clone of the current node including
6659  * all members and return a pointer to the node. This is used for
6660  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
6661  * ast.
6662  *
6663  * @return pointer to the clone/copy of the current node
6664  */
6665  IndependentBlock *clone() const override {
6666  return new IndependentBlock(*this);
6667  }
6668 
6669  /// \name Getters
6670  /// \{
6671 
6672  /**
6673  * \brief Return type (ast::AstNodeType) of ast node
6674  *
6675  * Every node in the ast has a type defined in ast::AstNodeType and this
6676  * function is used to retrieve the same.
6677  *
6678  * \return ast node type i.e. ast::AstNodeType::INDEPENDENT_BLOCK
6679  *
6680  * \sa Ast::get_node_type_name
6681  */
6682  AstNodeType get_node_type() const noexcept override {
6684  }
6685 
6686  /**
6687  * \brief Return type (ast::AstNodeType) of ast node as std::string
6688  *
6689  * Every node in the ast has a type defined in ast::AstNodeType.
6690  * This type name can be returned as a std::string for printing
6691  * node to text/json form.
6692  *
6693  * \return name of the node type as a string i.e. "IndependentBlock"
6694  *
6695  * \sa Ast::get_node_name
6696  */
6697  std::string get_node_type_name() const noexcept override {
6698  return "IndependentBlock";
6699  }
6700 
6701  /**
6702  * \brief Return NMODL statement of ast node as std::string
6703  *
6704  * Every node is related to a special statement in the NMODL. This
6705  * statement can be returned as a std::string for printing to
6706  * text/json form.
6707  *
6708  * \return name of the statement as a string i.e. "INDEPENDENT "
6709  *
6710  * \sa Ast::get_nmodl_name
6711  */
6712  std::string get_nmodl_name() const noexcept override {
6713  return "INDEPENDENT ";
6714  }
6715 
6716  /**
6717  * \brief Get std::shared_ptr from `this` pointer of the current ast node
6718  */
6719  std::shared_ptr<Ast> get_shared_ptr() override {
6720  return std::static_pointer_cast<IndependentBlock>(shared_from_this());
6721  }
6722 
6723  /**
6724  * \brief Get std::shared_ptr from `this` pointer of the current ast node
6725  */
6726  std::shared_ptr<const Ast> get_shared_ptr() const override {
6727  return std::static_pointer_cast<const IndependentBlock>(shared_from_this());
6728  }
6729 
6730  /**
6731  * \brief Return associated token for the current ast node
6732  *
6733  * Not all ast nodes have token information. For example,
6734  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
6735  * solution of ODEs. In this case, we return nullptr to store in the
6736  * nmodl::symtab::SymbolTable.
6737  *
6738  * \return pointer to token if exist otherwise nullptr
6739  */
6740  const ModToken *get_token() const noexcept override { return token.get(); }
6741 
6742  /**
6743  * \brief Return associated symbol table for the current ast node
6744  *
6745  * Only certain ast nodes (e.g. inherited from ast::Block) have associated
6746  * symbol table. These nodes have nmodl::symtab::SymbolTable as member
6747  * and it can be accessed using this method.
6748  *
6749  * \return pointer to the symbol table
6750  *
6751  * \sa nmodl::symtab::SymbolTable nmodl::visitor::SymtabVisitor
6752  */
6753  symtab::SymbolTable *get_symbol_table() const override { return symtab; }
6754 
6755  /**
6756  * \brief Getter for member variable \ref IndependentBlock.definitions
6757  */
6759  return definitions;
6760  }
6761 
6762  /// \}
6763 
6764  /// \name Setters
6765  /// \{
6766 
6767  /**
6768  * \brief Set token for the current ast node
6769  */
6770  void set_token(const ModToken &tok) {
6771  token = std::make_shared<ModToken>(tok);
6772  }
6773 
6774  /**
6775  * \brief Set symbol table for the current ast node
6776  *
6777  * Top level, block scoped nodes store symbol table in the ast node.
6778  * nmodl::visitor::SymtabVisitor then used this method to setup symbol table
6779  * for every node in the ast.
6780  *
6781  * \sa nmodl::visitor::SymtabVisitor
6782  */
6783  void set_symbol_table(symtab::SymbolTable *newsymtab) override {
6784  symtab = newsymtab;
6785  }
6786 
6787  /**
6788  * \brief Setter for member variable \ref IndependentBlock.definitions (rvalue
6789  * reference)
6790  */
6791  void set_definitions(IndependentDefinitionVector &&definitions);
6792 
6793  /**
6794  * \brief Setter for member variable \ref IndependentBlock.definitions
6795  */
6796  void set_definitions(const IndependentDefinitionVector &definitions);
6797 
6798  /// \}
6799 
6800  /// \name Visitor
6801  /// \{
6802 
6803  /**
6804  * \brief visit children i.e. member variables of current node using provided
6805  * visitor
6806  *
6807  * Different nodes in the AST have different members (i.e. children). This
6808  * method recursively visits children using provided visitor.
6809  *
6810  * \param v Concrete visitor that will be used to recursively visit children
6811  *
6812  * \sa Ast::visit_children for example.
6813  */
6814  void visit_children(visitor::Visitor &v) override;
6815 
6816  /**
6817  * \brief visit children i.e. member variables of current node using provided
6818  * visitor
6819  *
6820  * Different nodes in the AST have different members (i.e. children). This
6821  * method recursively visits children using provided visitor.
6822  *
6823  * \param v Concrete constant visitor that will be used to recursively visit
6824  * children
6825  *
6826  * \sa Ast::visit_children for example.
6827  */
6828  void visit_children(visitor::ConstVisitor &v) const override;
6829 
6830  /**
6831  * \brief accept (or visit) the current AST node using provided visitor
6832  *
6833  * Instead of visiting children of AST node, like Ast::visit_children,
6834  * accept allows to visit the current node itself using provided concrete
6835  * visitor.
6836  *
6837  * \param v Concrete visitor that will be used to recursively visit node
6838  *
6839  * \sa Ast::accept for example.
6840  */
6841  void accept(visitor::Visitor &v) override;
6842 
6843  /**
6844  * \copydoc accept(visitor::Visitor&)
6845  */
6846  void accept(visitor::ConstVisitor &v) const override;
6847 
6848  /// \}
6849 
6850 private:
6851  /**
6852  * \brief Set this object as parent for all the children
6853  *
6854  * This should be called in every object (with children) constructor
6855  * to set parents. Since it is called only in the constructors it
6856  * should not be virtual to avoid ambiguities (issue #295).
6857  */
6858  void set_parent_in_children();
6859 };
6860 
6861 /** @} */ // end of ast_class
6862 
6863 } // namespace ast
6864 } // namespace nmodl
6865 #endif // !NMODL_AST_INDEPENDENT_BLOCK_HPP
6866 #ifndef NMODL_AST_ASSIGNED_BLOCK_HPP
6867 #define NMODL_AST_ASSIGNED_BLOCK_HPP
6868 #define NMODL_AST_ASSIGNED_BLOCK_HPP_INLINE_DEFINITION_REQUIRED
6869 
6870 namespace nmodl {
6871 namespace ast {
6872 
6873 /**
6874  * @addtogroup ast_class
6875  * @ingroup ast
6876  * @{
6877  */
6878 
6879 /**
6880  * \brief Represents a `ASSIGNED` block in the NMODL
6881  *
6882  * The `ASSIGNED` block is used for declaring two kinds of variables :
6883  * - those that are given values outside the mod files
6884  * - those that appear on the left hand side of assignment statements within
6885  * the mod file
6886  *
6887  * Below is an example of `ASSIGNED` block in the mod file:
6888  *
6889  * \code{.mod}
6890  * ASSIGNED {
6891  * ina (mA/cm2)
6892  * gna (pS/um2)
6893  * mtau (ms) htau (ms)
6894  * tadj
6895  * }
6896  * \endcode
6897  *
6898  */
6899 class AssignedBlock : public Block {
6900 private:
6901  /// Vector of assigned variables
6903  /// token with location information
6904  std::shared_ptr<ModToken> token;
6905  /// symbol table for a block
6906  symtab::SymbolTable *symtab = nullptr;
6907 
6908 public:
6909  /// \name Ctor & dtor
6910  /// \{
6911 
6912  explicit AssignedBlock(AssignedDefinitionVector definitions);
6913  AssignedBlock(const AssignedBlock &obj);
6914 
6915  virtual ~AssignedBlock() = default;
6916 
6917  /// \}
6918 
6919  /**
6920  * \brief Check if the ast node is an instance of ast::AssignedBlock
6921  * \return true as object is of type ast::AssignedBlock
6922  */
6923  bool is_assigned_block() const noexcept override { return true; }
6924 
6925  /**
6926  * \brief Return a copy of the current node
6927  *
6928  * Recursively make a new copy/clone of the current node including
6929  * all members and return a pointer to the node. This is used for
6930  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
6931  * ast.
6932  *
6933  * @return pointer to the clone/copy of the current node
6934  */
6935  AssignedBlock *clone() const override { return new AssignedBlock(*this); }
6936 
6937  /// \name Getters
6938  /// \{
6939 
6940  /**
6941  * \brief Return type (ast::AstNodeType) of ast node
6942  *
6943  * Every node in the ast has a type defined in ast::AstNodeType and this
6944  * function is used to retrieve the same.
6945  *
6946  * \return ast node type i.e. ast::AstNodeType::ASSIGNED_BLOCK
6947  *
6948  * \sa Ast::get_node_type_name
6949  */
6950  AstNodeType get_node_type() const noexcept override {
6952  }
6953 
6954  /**
6955  * \brief Return type (ast::AstNodeType) of ast node as std::string
6956  *
6957  * Every node in the ast has a type defined in ast::AstNodeType.
6958  * This type name can be returned as a std::string for printing
6959  * node to text/json form.
6960  *
6961  * \return name of the node type as a string i.e. "AssignedBlock"
6962  *
6963  * \sa Ast::get_node_name
6964  */
6965  std::string get_node_type_name() const noexcept override {
6966  return "AssignedBlock";
6967  }
6968 
6969  /**
6970  * \brief Return NMODL statement of ast node as std::string
6971  *
6972  * Every node is related to a special statement in the NMODL. This
6973  * statement can be returned as a std::string for printing to
6974  * text/json form.
6975  *
6976  * \return name of the statement as a string i.e. "ASSIGNED "
6977  *
6978  * \sa Ast::get_nmodl_name
6979  */
6980  std::string get_nmodl_name() const noexcept override { return "ASSIGNED "; }
6981 
6982  /**
6983  * \brief Get std::shared_ptr from `this` pointer of the current ast node
6984  */
6985  std::shared_ptr<Ast> get_shared_ptr() override {
6986  return std::static_pointer_cast<AssignedBlock>(shared_from_this());
6987  }
6988 
6989  /**
6990  * \brief Get std::shared_ptr from `this` pointer of the current ast node
6991  */
6992  std::shared_ptr<const Ast> get_shared_ptr() const override {
6993  return std::static_pointer_cast<const AssignedBlock>(shared_from_this());
6994  }
6995 
6996  /**
6997  * \brief Return associated token for the current ast node
6998  *
6999  * Not all ast nodes have token information. For example,
7000  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
7001  * solution of ODEs. In this case, we return nullptr to store in the
7002  * nmodl::symtab::SymbolTable.
7003  *
7004  * \return pointer to token if exist otherwise nullptr
7005  */
7006  const ModToken *get_token() const noexcept override { return token.get(); }
7007 
7008  /**
7009  * \brief Return associated symbol table for the current ast node
7010  *
7011  * Only certain ast nodes (e.g. inherited from ast::Block) have associated
7012  * symbol table. These nodes have nmodl::symtab::SymbolTable as member
7013  * and it can be accessed using this method.
7014  *
7015  * \return pointer to the symbol table
7016  *
7017  * \sa nmodl::symtab::SymbolTable nmodl::visitor::SymtabVisitor
7018  */
7019  symtab::SymbolTable *get_symbol_table() const override { return symtab; }
7020 
7021  /**
7022  * \brief Add member to definitions by raw pointer
7023  */
7024  void emplace_back_assigned_definition(AssignedDefinition *n);
7025 
7026  /**
7027  * \brief Add member to definitions by shared_ptr
7028  */
7029  void emplace_back_assigned_definition(std::shared_ptr<AssignedDefinition> n);
7030 
7031  /**
7032  * \brief Erase member to definitions
7033  */
7034  AssignedDefinitionVector::const_iterator
7035  erase_assigned_definition(AssignedDefinitionVector::const_iterator first);
7036 
7037  /**
7038  * \brief Erase members to definitions
7039  */
7040  AssignedDefinitionVector::const_iterator
7041  erase_assigned_definition(AssignedDefinitionVector::const_iterator first,
7042  AssignedDefinitionVector::const_iterator last);
7043 
7044  /**
7045  * \brief Erase non-consecutive members to definitions
7046  *
7047  * loosely following the cpp reference of remove_if
7048  */
7049  size_t erase_assigned_definition(
7050  std::unordered_set<AssignedDefinition *> &to_be_erased);
7051 
7052  /**
7053  * \brief Insert member to definitions
7054  */
7055  AssignedDefinitionVector::const_iterator
7056  insert_assigned_definition(AssignedDefinitionVector::const_iterator position,
7057  const std::shared_ptr<AssignedDefinition> &n);
7058 
7059  /**
7060  * \brief Insert members to definitions
7061  */
7062  template <class NodeType, class InputIterator>
7063  void
7064  insert_assigned_definition(AssignedDefinitionVector::const_iterator position,
7065  NodeType &to, InputIterator first,
7066  InputIterator last);
7067 
7068  /**
7069  * \brief Reset member to definitions
7070  */
7071  void
7072  reset_assigned_definition(AssignedDefinitionVector::const_iterator position,
7073  AssignedDefinition *n);
7074 
7075  /**
7076  * \brief Reset member to definitions
7077  */
7078  void
7079  reset_assigned_definition(AssignedDefinitionVector::const_iterator position,
7080  std::shared_ptr<AssignedDefinition> n);
7081 
7082  /**
7083  * \brief Getter for member variable \ref AssignedBlock.definitions
7084  */
7085  const AssignedDefinitionVector &get_definitions() const noexcept {
7086  return definitions;
7087  }
7088 
7089  /// \}
7090 
7091  /// \name Setters
7092  /// \{
7093 
7094  /**
7095  * \brief Set token for the current ast node
7096  */
7097  void set_token(const ModToken &tok) {
7098  token = std::make_shared<ModToken>(tok);
7099  }
7100 
7101  /**
7102  * \brief Set symbol table for the current ast node
7103  *
7104  * Top level, block scoped nodes store symbol table in the ast node.
7105  * nmodl::visitor::SymtabVisitor then used this method to setup symbol table
7106  * for every node in the ast.
7107  *
7108  * \sa nmodl::visitor::SymtabVisitor
7109  */
7110  void set_symbol_table(symtab::SymbolTable *newsymtab) override {
7111  symtab = newsymtab;
7112  }
7113 
7114  /**
7115  * \brief Setter for member variable \ref AssignedBlock.definitions (rvalue
7116  * reference)
7117  */
7118  void set_definitions(AssignedDefinitionVector &&definitions);
7119 
7120  /**
7121  * \brief Setter for member variable \ref AssignedBlock.definitions
7122  */
7123  void set_definitions(const AssignedDefinitionVector &definitions);
7124 
7125  /// \}
7126 
7127  /// \name Visitor
7128  /// \{
7129 
7130  /**
7131  * \brief visit children i.e. member variables of current node using provided
7132  * visitor
7133  *
7134  * Different nodes in the AST have different members (i.e. children). This
7135  * method recursively visits children using provided visitor.
7136  *
7137  * \param v Concrete visitor that will be used to recursively visit children
7138  *
7139  * \sa Ast::visit_children for example.
7140  */
7141  void visit_children(visitor::Visitor &v) override;
7142 
7143  /**
7144  * \brief visit children i.e. member variables of current node using provided
7145  * visitor
7146  *
7147  * Different nodes in the AST have different members (i.e. children). This
7148  * method recursively visits children using provided visitor.
7149  *
7150  * \param v Concrete constant visitor that will be used to recursively visit
7151  * children
7152  *
7153  * \sa Ast::visit_children for example.
7154  */
7155  void visit_children(visitor::ConstVisitor &v) const override;
7156 
7157  /**
7158  * \brief accept (or visit) the current AST node using provided visitor
7159  *
7160  * Instead of visiting children of AST node, like Ast::visit_children,
7161  * accept allows to visit the current node itself using provided concrete
7162  * visitor.
7163  *
7164  * \param v Concrete visitor that will be used to recursively visit node
7165  *
7166  * \sa Ast::accept for example.
7167  */
7168  void accept(visitor::Visitor &v) override;
7169 
7170  /**
7171  * \copydoc accept(visitor::Visitor&)
7172  */
7173  void accept(visitor::ConstVisitor &v) const override;
7174 
7175  /// \}
7176 
7177 private:
7178  /**
7179  * \brief Set this object as parent for all the children
7180  *
7181  * This should be called in every object (with children) constructor
7182  * to set parents. Since it is called only in the constructors it
7183  * should not be virtual to avoid ambiguities (issue #295).
7184  */
7185  void set_parent_in_children();
7186 };
7187 
7188 /** @} */ // end of ast_class
7189 
7190 } // namespace ast
7191 } // namespace nmodl
7192 #endif // !NMODL_AST_ASSIGNED_BLOCK_HPP
7193 #ifndef NMODL_AST_STATE_BLOCK_HPP
7194 #define NMODL_AST_STATE_BLOCK_HPP
7195 
7196 namespace nmodl {
7197 namespace ast {
7198 
7199 /**
7200  * @addtogroup ast_class
7201  * @ingroup ast
7202  * @{
7203  */
7204 
7205 /**
7206  * \brief Represents a `STATE` block in the NMODL
7207  *
7208  * If a model involves differential equations, families of algebraic equations,
7209  * or kinetic reaction schemes, their dependent variables or unknowns are to be
7210  * listed in the `STATE` block. Below is an example of `STATE`:
7211  *
7212  * \code{.mod}
7213  * STATE {
7214  * m
7215  * h
7216  * }
7217  * \endcode
7218  *
7219  * Note that the state variable specification has form of
7220  * ast::AssignedDefinition and hence can have associated unit specification.
7221  *
7222  */
7223 class StateBlock : public Block {
7224 private:
7225  /// Vector of state variables
7227  /// token with location information
7228  std::shared_ptr<ModToken> token;
7229  /// symbol table for a block
7230  symtab::SymbolTable *symtab = nullptr;
7231 
7232 public:
7233  /// \name Ctor & dtor
7234  /// \{
7235 
7236  explicit StateBlock(AssignedDefinitionVector definitions);
7237  StateBlock(const StateBlock &obj);
7238 
7239  virtual ~StateBlock() = default;
7240 
7241  /// \}
7242 
7243  /**
7244  * \brief Check if the ast node is an instance of ast::StateBlock
7245  * \return true as object is of type ast::StateBlock
7246  */
7247  bool is_state_block() const noexcept override { return true; }
7248 
7249  /**
7250  * \brief Return a copy of the current node
7251  *
7252  * Recursively make a new copy/clone of the current node including
7253  * all members and return a pointer to the node. This is used for
7254  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
7255  * ast.
7256  *
7257  * @return pointer to the clone/copy of the current node
7258  */
7259  StateBlock *clone() const override { return new StateBlock(*this); }
7260 
7261  /// \name Getters
7262  /// \{
7263 
7264  /**
7265  * \brief Return type (ast::AstNodeType) of ast node
7266  *
7267  * Every node in the ast has a type defined in ast::AstNodeType and this
7268  * function is used to retrieve the same.
7269  *
7270  * \return ast node type i.e. ast::AstNodeType::STATE_BLOCK
7271  *
7272  * \sa Ast::get_node_type_name
7273  */
7274  AstNodeType get_node_type() const noexcept override {
7275  return AstNodeType::STATE_BLOCK;
7276  }
7277 
7278  /**
7279  * \brief Return type (ast::AstNodeType) of ast node as std::string
7280  *
7281  * Every node in the ast has a type defined in ast::AstNodeType.
7282  * This type name can be returned as a std::string for printing
7283  * node to text/json form.
7284  *
7285  * \return name of the node type as a string i.e. "StateBlock"
7286  *
7287  * \sa Ast::get_node_name
7288  */
7289  std::string get_node_type_name() const noexcept override {
7290  return "StateBlock";
7291  }
7292 
7293  /**
7294  * \brief Return NMODL statement of ast node as std::string
7295  *
7296  * Every node is related to a special statement in the NMODL. This
7297  * statement can be returned as a std::string for printing to
7298  * text/json form.
7299  *
7300  * \return name of the statement as a string i.e. "STATE "
7301  *
7302  * \sa Ast::get_nmodl_name
7303  */
7304  std::string get_nmodl_name() const noexcept override { return "STATE "; }
7305 
7306  /**
7307  * \brief Get std::shared_ptr from `this` pointer of the current ast node
7308  */
7309  std::shared_ptr<Ast> get_shared_ptr() override {
7310  return std::static_pointer_cast<StateBlock>(shared_from_this());
7311  }
7312 
7313  /**
7314  * \brief Get std::shared_ptr from `this` pointer of the current ast node
7315  */
7316  std::shared_ptr<const Ast> get_shared_ptr() const override {
7317  return std::static_pointer_cast<const StateBlock>(shared_from_this());
7318  }
7319 
7320  /**
7321  * \brief Return associated token for the current ast node
7322  *
7323  * Not all ast nodes have token information. For example,
7324  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
7325  * solution of ODEs. In this case, we return nullptr to store in the
7326  * nmodl::symtab::SymbolTable.
7327  *
7328  * \return pointer to token if exist otherwise nullptr
7329  */
7330  const ModToken *get_token() const noexcept override { return token.get(); }
7331 
7332  /**
7333  * \brief Return associated symbol table for the current ast node
7334  *
7335  * Only certain ast nodes (e.g. inherited from ast::Block) have associated
7336  * symbol table. These nodes have nmodl::symtab::SymbolTable as member
7337  * and it can be accessed using this method.
7338  *
7339  * \return pointer to the symbol table
7340  *
7341  * \sa nmodl::symtab::SymbolTable nmodl::visitor::SymtabVisitor
7342  */
7343  symtab::SymbolTable *get_symbol_table() const override { return symtab; }
7344 
7345  /**
7346  * \brief Getter for member variable \ref StateBlock.definitions
7347  */
7348  const AssignedDefinitionVector &get_definitions() const noexcept {
7349  return definitions;
7350  }
7351 
7352  /// \}
7353 
7354  /// \name Setters
7355  /// \{
7356 
7357  /**
7358  * \brief Set token for the current ast node
7359  */
7360  void set_token(const ModToken &tok) {
7361  token = std::make_shared<ModToken>(tok);
7362  }
7363 
7364  /**
7365  * \brief Set symbol table for the current ast node
7366  *
7367  * Top level, block scoped nodes store symbol table in the ast node.
7368  * nmodl::visitor::SymtabVisitor then used this method to setup symbol table
7369  * for every node in the ast.
7370  *
7371  * \sa nmodl::visitor::SymtabVisitor
7372  */
7373  void set_symbol_table(symtab::SymbolTable *newsymtab) override {
7374  symtab = newsymtab;
7375  }
7376 
7377  /**
7378  * \brief Setter for member variable \ref StateBlock.definitions (rvalue
7379  * reference)
7380  */
7381  void set_definitions(AssignedDefinitionVector &&definitions);
7382 
7383  /**
7384  * \brief Setter for member variable \ref StateBlock.definitions
7385  */
7386  void set_definitions(const AssignedDefinitionVector &definitions);
7387 
7388  /// \}
7389 
7390  /// \name Visitor
7391  /// \{
7392 
7393  /**
7394  * \brief visit children i.e. member variables of current node using provided
7395  * visitor
7396  *
7397  * Different nodes in the AST have different members (i.e. children). This
7398  * method recursively visits children using provided visitor.
7399  *
7400  * \param v Concrete visitor that will be used to recursively visit children
7401  *
7402  * \sa Ast::visit_children for example.
7403  */
7404  void visit_children(visitor::Visitor &v) override;
7405 
7406  /**
7407  * \brief visit children i.e. member variables of current node using provided
7408  * visitor
7409  *
7410  * Different nodes in the AST have different members (i.e. children). This
7411  * method recursively visits children using provided visitor.
7412  *
7413  * \param v Concrete constant visitor that will be used to recursively visit
7414  * children
7415  *
7416  * \sa Ast::visit_children for example.
7417  */
7418  void visit_children(visitor::ConstVisitor &v) const override;
7419 
7420  /**
7421  * \brief accept (or visit) the current AST node using provided visitor
7422  *
7423  * Instead of visiting children of AST node, like Ast::visit_children,
7424  * accept allows to visit the current node itself using provided concrete
7425  * visitor.
7426  *
7427  * \param v Concrete visitor that will be used to recursively visit node
7428  *
7429  * \sa Ast::accept for example.
7430  */
7431  void accept(visitor::Visitor &v) override;
7432 
7433  /**
7434  * \copydoc accept(visitor::Visitor&)
7435  */
7436  void accept(visitor::ConstVisitor &v) const override;
7437 
7438  /// \}
7439 
7440 private:
7441  /**
7442  * \brief Set this object as parent for all the children
7443  *
7444  * This should be called in every object (with children) constructor
7445  * to set parents. Since it is called only in the constructors it
7446  * should not be virtual to avoid ambiguities (issue #295).
7447  */
7448  void set_parent_in_children();
7449 };
7450 
7451 /** @} */ // end of ast_class
7452 
7453 } // namespace ast
7454 } // namespace nmodl
7455 #endif // !NMODL_AST_STATE_BLOCK_HPP
7456 #ifndef NMODL_AST_PLOT_BLOCK_HPP
7457 #define NMODL_AST_PLOT_BLOCK_HPP
7458 
7459 namespace nmodl {
7460 namespace ast {
7461 
7462 /**
7463  * @addtogroup ast_class
7464  * @ingroup ast
7465  * @{
7466  */
7467 
7468 /**
7469  * \brief Represents a `PLOT` statement in the NMODL
7470  *
7471  * `PLOT` construct doesn't have block scope but it's standalone, global scoped
7472  * statement of the form:
7473  *
7474  * \code{.mod}
7475  * PLOT name1, index_var2 VS name3
7476  * \endcode
7477  *
7478  * \todo Check ModelDB and other databse for example of channel.
7479  *
7480  */
7481 class PlotBlock : public Block {
7482 private:
7483  /// Vector of plot variables
7484  std::shared_ptr<PlotDeclaration> plot;
7485  /// token with location information
7486  std::shared_ptr<ModToken> token;
7487  /// symbol table for a block
7488  symtab::SymbolTable *symtab = nullptr;
7489 
7490 public:
7491  /// \name Ctor & dtor
7492  /// \{
7493 
7494  explicit PlotBlock(PlotDeclaration *plot);
7495  explicit PlotBlock(const std::shared_ptr<PlotDeclaration> &plot);
7496  PlotBlock(const PlotBlock &obj);
7497 
7498  virtual ~PlotBlock() = default;
7499 
7500  /// \}
7501 
7502  /**
7503  * \brief Check if the ast node is an instance of ast::PlotBlock
7504  * \return true as object is of type ast::PlotBlock
7505  */
7506  bool is_plot_block() const noexcept override { return true; }
7507 
7508  /**
7509  * \brief Return a copy of the current node
7510  *
7511  * Recursively make a new copy/clone of the current node including
7512  * all members and return a pointer to the node. This is used for
7513  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
7514  * ast.
7515  *
7516  * @return pointer to the clone/copy of the current node
7517  */
7518  PlotBlock *clone() const override { return new PlotBlock(*this); }
7519 
7520  /// \name Getters
7521  /// \{
7522 
7523  /**
7524  * \brief Return type (ast::AstNodeType) of ast node
7525  *
7526  * Every node in the ast has a type defined in ast::AstNodeType and this
7527  * function is used to retrieve the same.
7528  *
7529  * \return ast node type i.e. ast::AstNodeType::PLOT_BLOCK
7530  *
7531  * \sa Ast::get_node_type_name
7532  */
7533  AstNodeType get_node_type() const noexcept override {
7534  return AstNodeType::PLOT_BLOCK;
7535  }
7536 
7537  /**
7538  * \brief Return type (ast::AstNodeType) of ast node as std::string
7539  *
7540  * Every node in the ast has a type defined in ast::AstNodeType.
7541  * This type name can be returned as a std::string for printing
7542  * node to text/json form.
7543  *
7544  * \return name of the node type as a string i.e. "PlotBlock"
7545  *
7546  * \sa Ast::get_node_name
7547  */
7548  std::string get_node_type_name() const noexcept override {
7549  return "PlotBlock";
7550  }
7551 
7552  /**
7553  * \brief Get std::shared_ptr from `this` pointer of the current ast node
7554  */
7555  std::shared_ptr<Ast> get_shared_ptr() override {
7556  return std::static_pointer_cast<PlotBlock>(shared_from_this());
7557  }
7558 
7559  /**
7560  * \brief Get std::shared_ptr from `this` pointer of the current ast node
7561  */
7562  std::shared_ptr<const Ast> get_shared_ptr() const override {
7563  return std::static_pointer_cast<const PlotBlock>(shared_from_this());
7564  }
7565 
7566  /**
7567  * \brief Return associated token for the current ast node
7568  *
7569  * Not all ast nodes have token information. For example,
7570  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
7571  * solution of ODEs. In this case, we return nullptr to store in the
7572  * nmodl::symtab::SymbolTable.
7573  *
7574  * \return pointer to token if exist otherwise nullptr
7575  */
7576  const ModToken *get_token() const noexcept override { return token.get(); }
7577 
7578  /**
7579  * \brief Return associated symbol table for the current ast node
7580  *
7581  * Only certain ast nodes (e.g. inherited from ast::Block) have associated
7582  * symbol table. These nodes have nmodl::symtab::SymbolTable as member
7583  * and it can be accessed using this method.
7584  *
7585  * \return pointer to the symbol table
7586  *
7587  * \sa nmodl::symtab::SymbolTable nmodl::visitor::SymtabVisitor
7588  */
7589  symtab::SymbolTable *get_symbol_table() const override { return symtab; }
7590 
7591  /**
7592  * \brief Getter for member variable \ref PlotBlock.plot
7593  */
7594  const std::shared_ptr<PlotDeclaration> &get_plot() const noexcept {
7595  return plot;
7596  }
7597 
7598  /// \}
7599 
7600  /// \name Setters
7601  /// \{
7602 
7603  /**
7604  * \brief Set token for the current ast node
7605  */
7606  void set_token(const ModToken &tok) {
7607  token = std::make_shared<ModToken>(tok);
7608  }
7609 
7610  /**
7611  * \brief Set symbol table for the current ast node
7612  *
7613  * Top level, block scoped nodes store symbol table in the ast node.
7614  * nmodl::visitor::SymtabVisitor then used this method to setup symbol table
7615  * for every node in the ast.
7616  *
7617  * \sa nmodl::visitor::SymtabVisitor
7618  */
7619  void set_symbol_table(symtab::SymbolTable *newsymtab) override {
7620  symtab = newsymtab;
7621  }
7622 
7623  /**
7624  * \brief Setter for member variable \ref PlotBlock.plot (rvalue reference)
7625  */
7626  void set_plot(std::shared_ptr<PlotDeclaration> &&plot);
7627 
7628  /**
7629  * \brief Setter for member variable \ref PlotBlock.plot
7630  */
7631  void set_plot(const std::shared_ptr<PlotDeclaration> &plot);
7632 
7633  /// \}
7634 
7635  /// \name Visitor
7636  /// \{
7637 
7638  /**
7639  * \brief visit children i.e. member variables of current node using provided
7640  * visitor
7641  *
7642  * Different nodes in the AST have different members (i.e. children). This
7643  * method recursively visits children using provided visitor.
7644  *
7645  * \param v Concrete visitor that will be used to recursively visit children
7646  *
7647  * \sa Ast::visit_children for example.
7648  */
7649  void visit_children(visitor::Visitor &v) override;
7650 
7651  /**
7652  * \brief visit children i.e. member variables of current node using provided
7653  * visitor
7654  *
7655  * Different nodes in the AST have different members (i.e. children). This
7656  * method recursively visits children using provided visitor.
7657  *
7658  * \param v Concrete constant visitor that will be used to recursively visit
7659  * children
7660  *
7661  * \sa Ast::visit_children for example.
7662  */
7663  void visit_children(visitor::ConstVisitor &v) const override;
7664 
7665  /**
7666  * \brief accept (or visit) the current AST node using provided visitor
7667  *
7668  * Instead of visiting children of AST node, like Ast::visit_children,
7669  * accept allows to visit the current node itself using provided concrete
7670  * visitor.
7671  *
7672  * \param v Concrete visitor that will be used to recursively visit node
7673  *
7674  * \sa Ast::accept for example.
7675  */
7676  void accept(visitor::Visitor &v) override;
7677 
7678  /**
7679  * \copydoc accept(visitor::Visitor&)
7680  */
7681  void accept(visitor::ConstVisitor &v) const override;
7682 
7683  /// \}
7684 
7685 private:
7686  /**
7687  * \brief Set this object as parent for all the children
7688  *
7689  * This should be called in every object (with children) constructor
7690  * to set parents. Since it is called only in the constructors it
7691  * should not be virtual to avoid ambiguities (issue #295).
7692  */
7693  void set_parent_in_children();
7694 };
7695 
7696 /** @} */ // end of ast_class
7697 
7698 } // namespace ast
7699 } // namespace nmodl
7700 #endif // !NMODL_AST_PLOT_BLOCK_HPP
7701 #ifndef NMODL_AST_INITIAL_BLOCK_HPP
7702 #define NMODL_AST_INITIAL_BLOCK_HPP
7703 
7704 namespace nmodl {
7705 namespace ast {
7706 
7707 /**
7708  * @addtogroup ast_class
7709  * @ingroup ast
7710  * @{
7711  */
7712 
7713 /**
7714  * \brief Represents a `INITIAL` block in the NMODL
7715  *
7716  * The code in the `INITIAL` block is executed when the hoc function
7717  * `finitialize()` is called. Here is an example :
7718  *
7719  * \code{.mod}
7720  * INITIAL {
7721  * rates(v+vshift)
7722  * m = minf
7723  * h = hinf
7724  * tadj = q10^((celsius - temp)/10)
7725  * }
7726  * \endcode
7727  *
7728  */
7729 class InitialBlock : public Block {
7730 private:
7731  /// Block with statements vector
7732  std::shared_ptr<StatementBlock> statement_block;
7733  /// token with location information
7734  std::shared_ptr<ModToken> token;
7735  /// symbol table for a block
7736  symtab::SymbolTable *symtab = nullptr;
7737 
7738 public:
7739  /// \name Ctor & dtor
7740  /// \{
7741 
7742  explicit InitialBlock(StatementBlock *statement_block);
7743  explicit InitialBlock(const std::shared_ptr<StatementBlock> &statement_block);
7744  InitialBlock(const InitialBlock &obj);
7745 
7746  virtual ~InitialBlock() = default;
7747 
7748  /// \}
7749 
7750  /**
7751  * \brief Check if the ast node is an instance of ast::InitialBlock
7752  * \return true as object is of type ast::InitialBlock
7753  */
7754  bool is_initial_block() const noexcept override { return true; }
7755 
7756  /**
7757  * \brief Return a copy of the current node
7758  *
7759  * Recursively make a new copy/clone of the current node including
7760  * all members and return a pointer to the node. This is used for
7761  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
7762  * ast.
7763  *
7764  * @return pointer to the clone/copy of the current node
7765  */
7766  InitialBlock *clone() const override { return new InitialBlock(*this); }
7767 
7768  /// \name Getters
7769  /// \{
7770 
7771  /**
7772  * \brief Return type (ast::AstNodeType) of ast node
7773  *
7774  * Every node in the ast has a type defined in ast::AstNodeType and this
7775  * function is used to retrieve the same.
7776  *
7777  * \return ast node type i.e. ast::AstNodeType::INITIAL_BLOCK
7778  *
7779  * \sa Ast::get_node_type_name
7780  */
7781  AstNodeType get_node_type() const noexcept override {
7783  }
7784 
7785  /**
7786  * \brief Return type (ast::AstNodeType) of ast node as std::string
7787  *
7788  * Every node in the ast has a type defined in ast::AstNodeType.
7789  * This type name can be returned as a std::string for printing
7790  * node to text/json form.
7791  *
7792  * \return name of the node type as a string i.e. "InitialBlock"
7793  *
7794  * \sa Ast::get_node_name
7795  */
7796  std::string get_node_type_name() const noexcept override {
7797  return "InitialBlock";
7798  }
7799 
7800  /**
7801  * \brief Return NMODL statement of ast node as std::string
7802  *
7803  * Every node is related to a special statement in the NMODL. This
7804  * statement can be returned as a std::string for printing to
7805  * text/json form.
7806  *
7807  * \return name of the statement as a string i.e. "INITIAL "
7808  *
7809  * \sa Ast::get_nmodl_name
7810  */
7811  std::string get_nmodl_name() const noexcept override { return "INITIAL "; }
7812 
7813  /**
7814  * \brief Get std::shared_ptr from `this` pointer of the current ast node
7815  */
7816  std::shared_ptr<Ast> get_shared_ptr() override {
7817  return std::static_pointer_cast<InitialBlock>(shared_from_this());
7818  }
7819 
7820  /**
7821  * \brief Get std::shared_ptr from `this` pointer of the current ast node
7822  */
7823  std::shared_ptr<const Ast> get_shared_ptr() const override {
7824  return std::static_pointer_cast<const InitialBlock>(shared_from_this());
7825  }
7826 
7827  /**
7828  * \brief Return associated token for the current ast node
7829  *
7830  * Not all ast nodes have token information. For example,
7831  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
7832  * solution of ODEs. In this case, we return nullptr to store in the
7833  * nmodl::symtab::SymbolTable.
7834  *
7835  * \return pointer to token if exist otherwise nullptr
7836  */
7837  const ModToken *get_token() const noexcept override { return token.get(); }
7838 
7839  /**
7840  * \brief Return associated symbol table for the current ast node
7841  *
7842  * Only certain ast nodes (e.g. inherited from ast::Block) have associated
7843  * symbol table. These nodes have nmodl::symtab::SymbolTable as member
7844  * and it can be accessed using this method.
7845  *
7846  * \return pointer to the symbol table
7847  *
7848  * \sa nmodl::symtab::SymbolTable nmodl::visitor::SymtabVisitor
7849  */
7850  symtab::SymbolTable *get_symbol_table() const override { return symtab; }
7851 
7852  /**
7853  * \brief Getter for member variable \ref InitialBlock.statement_block
7854  */
7855  const std::shared_ptr<StatementBlock> &get_statement_block() const
7856  noexcept override {
7857  return statement_block;
7858  }
7859 
7860  /// \}
7861 
7862  /// \name Setters
7863  /// \{
7864 
7865  /**
7866  * \brief Set token for the current ast node
7867  */
7868  void set_token(const ModToken &tok) {
7869  token = std::make_shared<ModToken>(tok);
7870  }
7871 
7872  /**
7873  * \brief Set symbol table for the current ast node
7874  *
7875  * Top level, block scoped nodes store symbol table in the ast node.
7876  * nmodl::visitor::SymtabVisitor then used this method to setup symbol table
7877  * for every node in the ast.
7878  *
7879  * \sa nmodl::visitor::SymtabVisitor
7880  */
7881  void set_symbol_table(symtab::SymbolTable *newsymtab) override {
7882  symtab = newsymtab;
7883  }
7884 
7885  /**
7886  * \brief Setter for member variable \ref InitialBlock.statement_block (rvalue
7887  * reference)
7888  */
7889  void set_statement_block(std::shared_ptr<StatementBlock> &&statement_block);
7890 
7891  /**
7892  * \brief Setter for member variable \ref InitialBlock.statement_block
7893  */
7894  void
7895  set_statement_block(const std::shared_ptr<StatementBlock> &statement_block);
7896 
7897  /// \}
7898 
7899  /// \name Visitor
7900  /// \{
7901 
7902  /**
7903  * \brief visit children i.e. member variables of current node using provided
7904  * visitor
7905  *
7906  * Different nodes in the AST have different members (i.e. children). This
7907  * method recursively visits children using provided visitor.
7908  *
7909  * \param v Concrete visitor that will be used to recursively visit children
7910  *
7911  * \sa Ast::visit_children for example.
7912  */
7913  void visit_children(visitor::Visitor &v) override;
7914 
7915  /**
7916  * \brief visit children i.e. member variables of current node using provided
7917  * visitor
7918  *
7919  * Different nodes in the AST have different members (i.e. children). This
7920  * method recursively visits children using provided visitor.
7921  *
7922  * \param v Concrete constant visitor that will be used to recursively visit
7923  * children
7924  *
7925  * \sa Ast::visit_children for example.
7926  */
7927  void visit_children(visitor::ConstVisitor &v) const override;
7928 
7929  /**
7930  * \brief accept (or visit) the current AST node using provided visitor
7931  *
7932  * Instead of visiting children of AST node, like Ast::visit_children,
7933  * accept allows to visit the current node itself using provided concrete
7934  * visitor.
7935  *
7936  * \param v Concrete visitor that will be used to recursively visit node
7937  *
7938  * \sa Ast::accept for example.
7939  */
7940  void accept(visitor::Visitor &v) override;
7941 
7942  /**
7943  * \copydoc accept(visitor::Visitor&)
7944  */
7945  void accept(visitor::ConstVisitor &v) const override;
7946 
7947  /// \}
7948 
7949 private:
7950  /**
7951  * \brief Set this object as parent for all the children
7952  *
7953  * This should be called in every object (with children) constructor
7954  * to set parents. Since it is called only in the constructors it
7955  * should not be virtual to avoid ambiguities (issue #295).
7956  */
7957  void set_parent_in_children();
7958 };
7959 
7960 /** @} */ // end of ast_class
7961 
7962 } // namespace ast
7963 } // namespace nmodl
7964 #endif // !NMODL_AST_INITIAL_BLOCK_HPP
7965 #ifndef NMODL_AST_CONSTRUCTOR_BLOCK_HPP
7966 #define NMODL_AST_CONSTRUCTOR_BLOCK_HPP
7967 
7968 namespace nmodl {
7969 namespace ast {
7970 
7971 /**
7972  * @addtogroup ast_class
7973  * @ingroup ast
7974  * @{
7975  */
7976 
7977 /**
7978  * \brief Represents a `CONSTRUCTOR` block in the NMODL
7979  *
7980  * The code in the `CONSTRUCTOR` is called when the channel is instantiated.
7981  * Like any other global block, `CONSTRUCTOR` block can have any statements. It
7982  * often used with `VERBATIM` block for initialization purpose :
7983  *
7984  * \code{.mod}
7985  * CONSTRUCTOR {
7986  * VERBATIM
7987  * if (ifarg(1)) { id= *getarg(1); } else { id= -1; }
7988  * ENDVERBATIM
7989  * }
7990  * \endcode
7991  *
7992  * \sa ast::DestructorBlock
7993  *
7994  */
7995 class ConstructorBlock : public Block {
7996 private:
7997  /// Block with statements vector
7998  std::shared_ptr<StatementBlock> statement_block;
7999  /// token with location information
8000  std::shared_ptr<ModToken> token;
8001  /// symbol table for a block
8002  symtab::SymbolTable *symtab = nullptr;
8003 
8004 public:
8005  /// \name Ctor & dtor
8006  /// \{
8007 
8008  explicit ConstructorBlock(StatementBlock *statement_block);
8009  explicit ConstructorBlock(
8010  const std::shared_ptr<StatementBlock> &statement_block);
8011  ConstructorBlock(const ConstructorBlock &obj);
8012 
8013  virtual ~ConstructorBlock() = default;
8014 
8015  /// \}
8016 
8017  /**
8018  * \brief Check if the ast node is an instance of ast::ConstructorBlock
8019  * \return true as object is of type ast::ConstructorBlock
8020  */
8021  bool is_constructor_block() const noexcept override { return true; }
8022 
8023  /**
8024  * \brief Return a copy of the current node
8025  *
8026  * Recursively make a new copy/clone of the current node including
8027  * all members and return a pointer to the node. This is used for
8028  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
8029  * ast.
8030  *
8031  * @return pointer to the clone/copy of the current node
8032  */
8033  ConstructorBlock *clone() const override {
8034  return new ConstructorBlock(*this);
8035  }
8036 
8037  /// \name Getters
8038  /// \{
8039 
8040  /**
8041  * \brief Return type (ast::AstNodeType) of ast node
8042  *
8043  * Every node in the ast has a type defined in ast::AstNodeType and this
8044  * function is used to retrieve the same.
8045  *
8046  * \return ast node type i.e. ast::AstNodeType::CONSTRUCTOR_BLOCK
8047  *
8048  * \sa Ast::get_node_type_name
8049  */
8050  AstNodeType get_node_type() const noexcept override {
8052  }
8053 
8054  /**
8055  * \brief Return type (ast::AstNodeType) of ast node as std::string
8056  *
8057  * Every node in the ast has a type defined in ast::AstNodeType.
8058  * This type name can be returned as a std::string for printing
8059  * node to text/json form.
8060  *
8061  * \return name of the node type as a string i.e. "ConstructorBlock"
8062  *
8063  * \sa Ast::get_node_name
8064  */
8065  std::string get_node_type_name() const noexcept override {
8066  return "ConstructorBlock";
8067  }
8068 
8069  /**
8070  * \brief Return NMODL statement of ast node as std::string
8071  *
8072  * Every node is related to a special statement in the NMODL. This
8073  * statement can be returned as a std::string for printing to
8074  * text/json form.
8075  *
8076  * \return name of the statement as a string i.e. "CONSTRUCTOR "
8077  *
8078  * \sa Ast::get_nmodl_name
8079  */
8080  std::string get_nmodl_name() const noexcept override {
8081  return "CONSTRUCTOR ";
8082  }
8083 
8084  /**
8085  * \brief Get std::shared_ptr from `this` pointer of the current ast node
8086  */
8087  std::shared_ptr<Ast> get_shared_ptr() override {
8088  return std::static_pointer_cast<ConstructorBlock>(shared_from_this());
8089  }
8090 
8091  /**
8092  * \brief Get std::shared_ptr from `this` pointer of the current ast node
8093  */
8094  std::shared_ptr<const Ast> get_shared_ptr() const override {
8095  return std::static_pointer_cast<const ConstructorBlock>(shared_from_this());
8096  }
8097 
8098  /**
8099  * \brief Return associated token for the current ast node
8100  *
8101  * Not all ast nodes have token information. For example,
8102  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
8103  * solution of ODEs. In this case, we return nullptr to store in the
8104  * nmodl::symtab::SymbolTable.
8105  *
8106  * \return pointer to token if exist otherwise nullptr
8107  */
8108  const ModToken *get_token() const noexcept override { return token.get(); }
8109 
8110  /**
8111  * \brief Return associated symbol table for the current ast node
8112  *
8113  * Only certain ast nodes (e.g. inherited from ast::Block) have associated
8114  * symbol table. These nodes have nmodl::symtab::SymbolTable as member
8115  * and it can be accessed using this method.
8116  *
8117  * \return pointer to the symbol table
8118  *
8119  * \sa nmodl::symtab::SymbolTable nmodl::visitor::SymtabVisitor
8120  */
8121  symtab::SymbolTable *get_symbol_table() const override { return symtab; }
8122 
8123  /**
8124  * \brief Getter for member variable \ref ConstructorBlock.statement_block
8125  */
8126  const std::shared_ptr<StatementBlock> &get_statement_block() const
8127  noexcept override {
8128  return statement_block;
8129  }
8130 
8131  /// \}
8132 
8133  /// \name Setters
8134  /// \{
8135 
8136  /**
8137  * \brief Set token for the current ast node
8138  */
8139  void set_token(const ModToken &tok) {
8140  token = std::make_shared<ModToken>(tok);
8141  }
8142 
8143  /**
8144  * \brief Set symbol table for the current ast node
8145  *
8146  * Top level, block scoped nodes store symbol table in the ast node.
8147  * nmodl::visitor::SymtabVisitor then used this method to setup symbol table
8148  * for every node in the ast.
8149  *
8150  * \sa nmodl::visitor::SymtabVisitor
8151  */
8152  void set_symbol_table(symtab::SymbolTable *newsymtab) override {
8153  symtab = newsymtab;
8154  }
8155 
8156  /**
8157  * \brief Setter for member variable \ref ConstructorBlock.statement_block
8158  * (rvalue reference)
8159  */
8160  void set_statement_block(std::shared_ptr<StatementBlock> &&statement_block);
8161 
8162  /**
8163  * \brief Setter for member variable \ref ConstructorBlock.statement_block
8164  */
8165  void
8166  set_statement_block(const std::shared_ptr<StatementBlock> &statement_block);
8167 
8168  /// \}
8169 
8170  /// \name Visitor
8171  /// \{
8172 
8173  /**
8174  * \brief visit children i.e. member variables of current node using provided
8175  * visitor
8176  *
8177  * Different nodes in the AST have different members (i.e. children). This
8178  * method recursively visits children using provided visitor.
8179  *
8180  * \param v Concrete visitor that will be used to recursively visit children
8181  *
8182  * \sa Ast::visit_children for example.
8183  */
8184  void visit_children(visitor::Visitor &v) override;
8185 
8186  /**
8187  * \brief visit children i.e. member variables of current node using provided
8188  * visitor
8189  *
8190  * Different nodes in the AST have different members (i.e. children). This
8191  * method recursively visits children using provided visitor.
8192  *
8193  * \param v Concrete constant visitor that will be used to recursively visit
8194  * children
8195  *
8196  * \sa Ast::visit_children for example.
8197  */
8198  void visit_children(visitor::ConstVisitor &v) const override;
8199 
8200  /**
8201  * \brief accept (or visit) the current AST node using provided visitor
8202  *
8203  * Instead of visiting children of AST node, like Ast::visit_children,
8204  * accept allows to visit the current node itself using provided concrete
8205  * visitor.
8206  *
8207  * \param v Concrete visitor that will be used to recursively visit node
8208  *
8209  * \sa Ast::accept for example.
8210  */
8211  void accept(visitor::Visitor &v) override;
8212 
8213  /**
8214  * \copydoc accept(visitor::Visitor&)
8215  */
8216  void accept(visitor::ConstVisitor &v) const override;
8217 
8218  /// \}
8219 
8220 private:
8221  /**
8222  * \brief Set this object as parent for all the children
8223  *
8224  * This should be called in every object (with children) constructor
8225  * to set parents. Since it is called only in the constructors it
8226  * should not be virtual to avoid ambiguities (issue #295).
8227  */
8228  void set_parent_in_children();
8229 };
8230 
8231 /** @} */ // end of ast_class
8232 
8233 } // namespace ast
8234 } // namespace nmodl
8235 #endif // !NMODL_AST_CONSTRUCTOR_BLOCK_HPP
8236 #ifndef NMODL_AST_DESTRUCTOR_BLOCK_HPP
8237 #define NMODL_AST_DESTRUCTOR_BLOCK_HPP
8238 
8239 namespace nmodl {
8240 namespace ast {
8241 
8242 /**
8243  * @addtogroup ast_class
8244  * @ingroup ast
8245  * @{
8246  */
8247 
8248 /**
8249  * \brief Represents a `DESTRUCTOR` block in the NMODL
8250  *
8251  * The code in the `DESTRUCTOR` is called when the channel instance is deleted.
8252  * It often used with `VERBATIM` block for finalization purpose :
8253  *
8254  * \code{.mod}
8255  * DESTRUCTOR {
8256  * VERBATIM {
8257  * nsyn = maxsyn = 0;
8258  * free(PRECAST);
8259  * link = 0;
8260  * }
8261  * ENDVERBATIM
8262  * }
8263  * \endcode
8264  *
8265  * \sa ast::ConstructorBlock
8266  *
8267  */
8268 class DestructorBlock : public Block {
8269 private:
8270  /// Block with statements vector
8271  std::shared_ptr<StatementBlock> statement_block;
8272  /// token with location information
8273  std::shared_ptr<ModToken> token;
8274  /// symbol table for a block
8275  symtab::SymbolTable *symtab = nullptr;
8276 
8277 public:
8278  /// \name Ctor & dtor
8279  /// \{
8280 
8281  explicit DestructorBlock(StatementBlock *statement_block);
8282  explicit DestructorBlock(
8283  const std::shared_ptr<StatementBlock> &statement_block);
8284  DestructorBlock(const DestructorBlock &obj);
8285 
8286  virtual ~DestructorBlock() = default;
8287 
8288  /// \}
8289 
8290  /**
8291  * \brief Check if the ast node is an instance of ast::DestructorBlock
8292  * \return true as object is of type ast::DestructorBlock
8293  */
8294  bool is_destructor_block() const noexcept override { return true; }
8295 
8296  /**
8297  * \brief Return a copy of the current node
8298  *
8299  * Recursively make a new copy/clone of the current node including
8300  * all members and return a pointer to the node. This is used for
8301  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
8302  * ast.
8303  *
8304  * @return pointer to the clone/copy of the current node
8305  */
8306  DestructorBlock *clone() const override { return new DestructorBlock(*this); }
8307 
8308  /// \name Getters
8309  /// \{
8310 
8311  /**
8312  * \brief Return type (ast::AstNodeType) of ast node
8313  *
8314  * Every node in the ast has a type defined in ast::AstNodeType and this
8315  * function is used to retrieve the same.
8316  *
8317  * \return ast node type i.e. ast::AstNodeType::DESTRUCTOR_BLOCK
8318  *
8319  * \sa Ast::get_node_type_name
8320  */
8321  AstNodeType get_node_type() const noexcept override {
8323  }
8324 
8325  /**
8326  * \brief Return type (ast::AstNodeType) of ast node as std::string
8327  *
8328  * Every node in the ast has a type defined in ast::AstNodeType.
8329  * This type name can be returned as a std::string for printing
8330  * node to text/json form.
8331  *
8332  * \return name of the node type as a string i.e. "DestructorBlock"
8333  *
8334  * \sa Ast::get_node_name
8335  */
8336  std::string get_node_type_name() const noexcept override {
8337  return "DestructorBlock";
8338  }
8339 
8340  /**
8341  * \brief Return NMODL statement of ast node as std::string
8342  *
8343  * Every node is related to a special statement in the NMODL. This
8344  * statement can be returned as a std::string for printing to
8345  * text/json form.
8346  *
8347  * \return name of the statement as a string i.e. "DESTRUCTOR "
8348  *
8349  * \sa Ast::get_nmodl_name
8350  */
8351  std::string get_nmodl_name() const noexcept override { return "DESTRUCTOR "; }
8352 
8353  /**
8354  * \brief Get std::shared_ptr from `this` pointer of the current ast node
8355  */
8356  std::shared_ptr<Ast> get_shared_ptr() override {
8357  return std::static_pointer_cast<DestructorBlock>(shared_from_this());
8358  }
8359 
8360  /**
8361  * \brief Get std::shared_ptr from `this` pointer of the current ast node
8362  */
8363  std::shared_ptr<const Ast> get_shared_ptr() const override {
8364  return std::static_pointer_cast<const DestructorBlock>(shared_from_this());
8365  }
8366 
8367  /**
8368  * \brief Return associated token for the current ast node
8369  *
8370  * Not all ast nodes have token information. For example,
8371  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
8372  * solution of ODEs. In this case, we return nullptr to store in the
8373  * nmodl::symtab::SymbolTable.
8374  *
8375  * \return pointer to token if exist otherwise nullptr
8376  */
8377  const ModToken *get_token() const noexcept override { return token.get(); }
8378 
8379  /**
8380  * \brief Return associated symbol table for the current ast node
8381  *
8382  * Only certain ast nodes (e.g. inherited from ast::Block) have associated
8383  * symbol table. These nodes have nmodl::symtab::SymbolTable as member
8384  * and it can be accessed using this method.
8385  *
8386  * \return pointer to the symbol table
8387  *
8388  * \sa nmodl::symtab::SymbolTable nmodl::visitor::SymtabVisitor
8389  */
8390  symtab::SymbolTable *get_symbol_table() const override { return symtab; }
8391 
8392  /**
8393  * \brief Getter for member variable \ref DestructorBlock.statement_block
8394  */
8395  const std::shared_ptr<StatementBlock> &get_statement_block() const
8396  noexcept override {
8397  return statement_block;
8398  }
8399 
8400  /// \}
8401 
8402  /// \name Setters
8403  /// \{
8404 
8405  /**
8406  * \brief Set token for the current ast node
8407  */
8408  void set_token(const ModToken &tok) {
8409  token = std::make_shared<ModToken>(tok);
8410  }
8411 
8412  /**
8413  * \brief Set symbol table for the current ast node
8414  *
8415  * Top level, block scoped nodes store symbol table in the ast node.
8416  * nmodl::visitor::SymtabVisitor then used this method to setup symbol table
8417  * for every node in the ast.
8418  *
8419  * \sa nmodl::visitor::SymtabVisitor
8420  */
8421  void set_symbol_table(symtab::SymbolTable *newsymtab) override {
8422  symtab = newsymtab;
8423  }
8424 
8425  /**
8426  * \brief Setter for member variable \ref DestructorBlock.statement_block
8427  * (rvalue reference)
8428  */
8429  void set_statement_block(std::shared_ptr<StatementBlock> &&statement_block);
8430 
8431  /**
8432  * \brief Setter for member variable \ref DestructorBlock.statement_block
8433  */
8434  void
8435  set_statement_block(const std::shared_ptr<StatementBlock> &statement_block);
8436 
8437  /// \}
8438 
8439  /// \name Visitor
8440  /// \{
8441 
8442  /**
8443  * \brief visit children i.e. member variables of current node using provided
8444  * visitor
8445  *
8446  * Different nodes in the AST have different members (i.e. children). This
8447  * method recursively visits children using provided visitor.
8448  *
8449  * \param v Concrete visitor that will be used to recursively visit children
8450  *
8451  * \sa Ast::visit_children for example.
8452  */
8453  void visit_children(visitor::Visitor &v) override;
8454 
8455  /**
8456  * \brief visit children i.e. member variables of current node using provided
8457  * visitor
8458  *
8459  * Different nodes in the AST have different members (i.e. children). This
8460  * method recursively visits children using provided visitor.
8461  *
8462  * \param v Concrete constant visitor that will be used to recursively visit
8463  * children
8464  *
8465  * \sa Ast::visit_children for example.
8466  */
8467  void visit_children(visitor::ConstVisitor &v) const override;
8468 
8469  /**
8470  * \brief accept (or visit) the current AST node using provided visitor
8471  *
8472  * Instead of visiting children of AST node, like Ast::visit_children,
8473  * accept allows to visit the current node itself using provided concrete
8474  * visitor.
8475  *
8476  * \param v Concrete visitor that will be used to recursively visit node
8477  *
8478  * \sa Ast::accept for example.
8479  */
8480  void accept(visitor::Visitor &v) override;
8481 
8482  /**
8483  * \copydoc accept(visitor::Visitor&)
8484  */
8485  void accept(visitor::ConstVisitor &v) const override;
8486 
8487  /// \}
8488 
8489 private:
8490  /**
8491  * \brief Set this object as parent for all the children
8492  *
8493  * This should be called in every object (with children) constructor
8494  * to set parents. Since it is called only in the constructors it
8495  * should not be virtual to avoid ambiguities (issue #295).
8496  */
8497  void set_parent_in_children();
8498 };
8499 
8500 /** @} */ // end of ast_class
8501 
8502 } // namespace ast
8503 } // namespace nmodl
8504 #endif // !NMODL_AST_DESTRUCTOR_BLOCK_HPP
8505 #ifndef NMODL_AST_STATEMENT_BLOCK_HPP
8506 #define NMODL_AST_STATEMENT_BLOCK_HPP
8507 #define NMODL_AST_STATEMENT_BLOCK_HPP_INLINE_DEFINITION_REQUIRED
8508 
8509 namespace nmodl {
8510 namespace ast {
8511 
8512 /**
8513  * @addtogroup ast_class
8514  * @ingroup ast
8515  * @{
8516  */
8517 
8518 /**
8519  * \brief Represents block encapsulating list of statements
8520  *
8521  * Statement block is used to hold list of statements between `{ }`. This
8522  * represents a new block scope in the mod file and has following form :
8523  *
8524  * \code{.mod}
8525  * {
8526  * statement1
8527  * {
8528  * statement2
8529  * }
8530  * }
8531  * \endcode
8532  *
8533  * Note that the statement blocks can be nested where inner block will
8534  * be wrapped as statement with ast::ExpressionStatement.
8535  *
8536  */
8537 class StatementBlock : public Block {
8538 private:
8539  /// Vector of statements
8541  /// token with location information
8542  std::shared_ptr<ModToken> token;
8543  /// symbol table for a block
8544  symtab::SymbolTable *symtab = nullptr;
8545 
8546 public:
8547  /// \name Ctor & dtor
8548  /// \{
8549 
8550  explicit StatementBlock(StatementVector statements);
8551  StatementBlock(const StatementBlock &obj);
8552 
8553  virtual ~StatementBlock() = default;
8554 
8555  /// \}
8556 
8557  /**
8558  * \brief Check if the ast node is an instance of ast::StatementBlock
8559  * \return true as object is of type ast::StatementBlock
8560  */
8561  bool is_statement_block() const noexcept override { return true; }
8562 
8563  /**
8564  * \brief Return a copy of the current node
8565  *
8566  * Recursively make a new copy/clone of the current node including
8567  * all members and return a pointer to the node. This is used for
8568  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
8569  * ast.
8570  *
8571  * @return pointer to the clone/copy of the current node
8572  */
8573  StatementBlock *clone() const override { return new StatementBlock(*this); }
8574 
8575  /// \name Getters
8576  /// \{
8577 
8578  /**
8579  * \brief Return type (ast::AstNodeType) of ast node
8580  *
8581  * Every node in the ast has a type defined in ast::AstNodeType and this
8582  * function is used to retrieve the same.
8583  *
8584  * \return ast node type i.e. ast::AstNodeType::STATEMENT_BLOCK
8585  *
8586  * \sa Ast::get_node_type_name
8587  */
8588  AstNodeType get_node_type() const noexcept override {
8590  }
8591 
8592  /**
8593  * \brief Return type (ast::AstNodeType) of ast node as std::string
8594  *
8595  * Every node in the ast has a type defined in ast::AstNodeType.
8596  * This type name can be returned as a std::string for printing
8597  * node to text/json form.
8598  *
8599  * \return name of the node type as a string i.e. "StatementBlock"
8600  *
8601  * \sa Ast::get_node_name
8602  */
8603  std::string get_node_type_name() const noexcept override {
8604  return "StatementBlock";
8605  }
8606 
8607  /**
8608  * \brief Get std::shared_ptr from `this` pointer of the current ast node
8609  */
8610  std::shared_ptr<Ast> get_shared_ptr() override {
8611  return std::static_pointer_cast<StatementBlock>(shared_from_this());
8612  }
8613 
8614  /**
8615  * \brief Get std::shared_ptr from `this` pointer of the current ast node
8616  */
8617  std::shared_ptr<const Ast> get_shared_ptr() const override {
8618  return std::static_pointer_cast<const StatementBlock>(shared_from_this());
8619  }
8620 
8621  /**
8622  * \brief Return associated token for the current ast node
8623  *
8624  * Not all ast nodes have token information. For example,
8625  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
8626  * solution of ODEs. In this case, we return nullptr to store in the
8627  * nmodl::symtab::SymbolTable.
8628  *
8629  * \return pointer to token if exist otherwise nullptr
8630  */
8631  const ModToken *get_token() const noexcept override { return token.get(); }
8632 
8633  /**
8634  * \brief Return associated symbol table for the current ast node
8635  *
8636  * Only certain ast nodes (e.g. inherited from ast::Block) have associated
8637  * symbol table. These nodes have nmodl::symtab::SymbolTable as member
8638  * and it can be accessed using this method.
8639  *
8640  * \return pointer to the symbol table
8641  *
8642  * \sa nmodl::symtab::SymbolTable nmodl::visitor::SymtabVisitor
8643  */
8644  symtab::SymbolTable *get_symbol_table() const override { return symtab; }
8645 
8646  /**
8647  * \brief Add member to statements by raw pointer
8648  */
8649  void emplace_back_statement(Statement *n);
8650 
8651  /**
8652  * \brief Add member to statements by shared_ptr
8653  */
8654  void emplace_back_statement(std::shared_ptr<Statement> n);
8655 
8656  /**
8657  * \brief Erase member to statements
8658  */
8659  StatementVector::const_iterator
8660  erase_statement(StatementVector::const_iterator first);
8661 
8662  /**
8663  * \brief Erase members to statements
8664  */
8665  StatementVector::const_iterator
8666  erase_statement(StatementVector::const_iterator first,
8667  StatementVector::const_iterator last);
8668 
8669  /**
8670  * \brief Erase non-consecutive members to statements
8671  *
8672  * loosely following the cpp reference of remove_if
8673  */
8674  size_t erase_statement(std::unordered_set<Statement *> &to_be_erased);
8675 
8676  /**
8677  * \brief Insert member to statements
8678  */
8679  StatementVector::const_iterator
8680  insert_statement(StatementVector::const_iterator position,
8681  const std::shared_ptr<Statement> &n);
8682 
8683  /**
8684  * \brief Insert members to statements
8685  */
8686  template <class NodeType, class InputIterator>
8687  void insert_statement(StatementVector::const_iterator position, NodeType &to,
8688  InputIterator first, InputIterator last);
8689 
8690  /**
8691  * \brief Reset member to statements
8692  */
8693  void reset_statement(StatementVector::const_iterator position, Statement *n);
8694 
8695  /**
8696  * \brief Reset member to statements
8697  */
8698  void reset_statement(StatementVector::const_iterator position,
8699  std::shared_ptr<Statement> n);
8700 
8701  /**
8702  * \brief Getter for member variable \ref StatementBlock.statements
8703  */
8704  const StatementVector &get_statements() const noexcept { return statements; }
8705 
8706  /// \}
8707 
8708  /// \name Setters
8709  /// \{
8710 
8711  /**
8712  * \brief Set token for the current ast node
8713  */
8714  void set_token(const ModToken &tok) {
8715  token = std::make_shared<ModToken>(tok);
8716  }
8717 
8718  /**
8719  * \brief Set symbol table for the current ast node
8720  *
8721  * Top level, block scoped nodes store symbol table in the ast node.
8722  * nmodl::visitor::SymtabVisitor then used this method to setup symbol table
8723  * for every node in the ast.
8724  *
8725  * \sa nmodl::visitor::SymtabVisitor
8726  */
8727  void set_symbol_table(symtab::SymbolTable *newsymtab) override {
8728  symtab = newsymtab;
8729  }
8730 
8731  /**
8732  * \brief Setter for member variable \ref StatementBlock.statements (rvalue
8733  * reference)
8734  */
8735  void set_statements(StatementVector &&statements);
8736 
8737  /**
8738  * \brief Setter for member variable \ref StatementBlock.statements
8739  */
8740  void set_statements(const StatementVector &statements);
8741 
8742  /// \}
8743 
8744  /// \name Visitor
8745  /// \{
8746 
8747  /**
8748  * \brief visit children i.e. member variables of current node using provided
8749  * visitor
8750  *
8751  * Different nodes in the AST have different members (i.e. children). This
8752  * method recursively visits children using provided visitor.
8753  *
8754  * \param v Concrete visitor that will be used to recursively visit children
8755  *
8756  * \sa Ast::visit_children for example.
8757  */
8758  void visit_children(visitor::Visitor &v) override;
8759 
8760  /**
8761  * \brief visit children i.e. member variables of current node using provided
8762  * visitor
8763  *
8764  * Different nodes in the AST have different members (i.e. children). This
8765  * method recursively visits children using provided visitor.
8766  *
8767  * \param v Concrete constant visitor that will be used to recursively visit
8768  * children
8769  *
8770  * \sa Ast::visit_children for example.
8771  */
8772  void visit_children(visitor::ConstVisitor &v) const override;
8773 
8774  /**
8775  * \brief accept (or visit) the current AST node using provided visitor
8776  *
8777  * Instead of visiting children of AST node, like Ast::visit_children,
8778  * accept allows to visit the current node itself using provided concrete
8779  * visitor.
8780  *
8781  * \param v Concrete visitor that will be used to recursively visit node
8782  *
8783  * \sa Ast::accept for example.
8784  */
8785  void accept(visitor::Visitor &v) override;
8786 
8787  /**
8788  * \copydoc accept(visitor::Visitor&)
8789  */
8790  void accept(visitor::ConstVisitor &v) const override;
8791 
8792  /// \}
8793 
8794 private:
8795  /**
8796  * \brief Set this object as parent for all the children
8797  *
8798  * This should be called in every object (with children) constructor
8799  * to set parents. Since it is called only in the constructors it
8800  * should not be virtual to avoid ambiguities (issue #295).
8801  */
8802  void set_parent_in_children();
8803 };
8804 
8805 /** @} */ // end of ast_class
8806 
8807 } // namespace ast
8808 } // namespace nmodl
8809 #endif // !NMODL_AST_STATEMENT_BLOCK_HPP
8810 #ifndef NMODL_AST_DERIVATIVE_BLOCK_HPP
8811 #define NMODL_AST_DERIVATIVE_BLOCK_HPP
8812 
8813 namespace nmodl {
8814 namespace ast {
8815 
8816 /**
8817  * @addtogroup ast_class
8818  * @ingroup ast
8819  * @{
8820  */
8821 
8822 /**
8823  * \brief Represents `DERIVATIVE` block in the NMODL
8824  *
8825  * This block is used to assign values to the derivatives of those
8826  * `STATE`s that are described by differential equations. The statements
8827  * in this block are of the form \f$y' = expr\f$. Here is an example :
8828  *
8829  * \code{.mod}
8830  * DERIVATIVE states {
8831  * rates(v)
8832  * m' = (minf-m)/mtau
8833  * h' = (hinf-h)/htau
8834  * }
8835  * \endcode
8836  *
8837  */
8838 class DerivativeBlock : public Block {
8839 private:
8840  /// Name of the derivative block
8841  std::shared_ptr<Name> name;
8842  /// Block with statements vector
8843  std::shared_ptr<StatementBlock> statement_block;
8844  /// token with location information
8845  std::shared_ptr<ModToken> token;
8846  /// symbol table for a block
8847  symtab::SymbolTable *symtab = nullptr;
8848 
8849 public:
8850  /// \name Ctor & dtor
8851  /// \{
8852 
8853  explicit DerivativeBlock(Name *name, StatementBlock *statement_block);
8854  explicit DerivativeBlock(
8855  const std::shared_ptr<Name> &name,
8856  const std::shared_ptr<StatementBlock> &statement_block);
8857  DerivativeBlock(const DerivativeBlock &obj);
8858 
8859  virtual ~DerivativeBlock() = default;
8860 
8861  /// \}
8862 
8863  /**
8864  * \brief Check if the ast node is an instance of ast::DerivativeBlock
8865  * \return true as object is of type ast::DerivativeBlock
8866  */
8867  bool is_derivative_block() const noexcept override { return true; }
8868 
8869  /**
8870  * \brief Return a copy of the current node
8871  *
8872  * Recursively make a new copy/clone of the current node including
8873  * all members and return a pointer to the node. This is used for
8874  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
8875  * ast.
8876  *
8877  * @return pointer to the clone/copy of the current node
8878  */
8879  DerivativeBlock *clone() const override { return new DerivativeBlock(*this); }
8880 
8881  /// \name Getters
8882  /// \{
8883 
8884  /**
8885  * \brief Return type (ast::AstNodeType) of ast node
8886  *
8887  * Every node in the ast has a type defined in ast::AstNodeType and this
8888  * function is used to retrieve the same.
8889  *
8890  * \return ast node type i.e. ast::AstNodeType::DERIVATIVE_BLOCK
8891  *
8892  * \sa Ast::get_node_type_name
8893  */
8894  AstNodeType get_node_type() const noexcept override {
8896  }
8897 
8898  /**
8899  * \brief Return type (ast::AstNodeType) of ast node as std::string
8900  *
8901  * Every node in the ast has a type defined in ast::AstNodeType.
8902  * This type name can be returned as a std::string for printing
8903  * node to text/json form.
8904  *
8905  * \return name of the node type as a string i.e. "DerivativeBlock"
8906  *
8907  * \sa Ast::get_node_name
8908  */
8909  std::string get_node_type_name() const noexcept override {
8910  return "DerivativeBlock";
8911  }
8912 
8913  /**
8914  * \brief Return NMODL statement of ast node as std::string
8915  *
8916  * Every node is related to a special statement in the NMODL. This
8917  * statement can be returned as a std::string for printing to
8918  * text/json form.
8919  *
8920  * \return name of the statement as a string i.e. "DERIVATIVE "
8921  *
8922  * \sa Ast::get_nmodl_name
8923  */
8924  std::string get_nmodl_name() const noexcept override { return "DERIVATIVE "; }
8925 
8926  /**
8927  * \brief Get std::shared_ptr from `this` pointer of the current ast node
8928  */
8929  std::shared_ptr<Ast> get_shared_ptr() override {
8930  return std::static_pointer_cast<DerivativeBlock>(shared_from_this());
8931  }
8932 
8933  /**
8934  * \brief Get std::shared_ptr from `this` pointer of the current ast node
8935  */
8936  std::shared_ptr<const Ast> get_shared_ptr() const override {
8937  return std::static_pointer_cast<const DerivativeBlock>(shared_from_this());
8938  }
8939 
8940  /**
8941  * \brief Return associated token for the current ast node
8942  *
8943  * Not all ast nodes have token information. For example,
8944  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
8945  * solution of ODEs. In this case, we return nullptr to store in the
8946  * nmodl::symtab::SymbolTable.
8947  *
8948  * \return pointer to token if exist otherwise nullptr
8949  */
8950  const ModToken *get_token() const noexcept override { return token.get(); }
8951 
8952  /**
8953  * \brief Return associated symbol table for the current ast node
8954  *
8955  * Only certain ast nodes (e.g. inherited from ast::Block) have associated
8956  * symbol table. These nodes have nmodl::symtab::SymbolTable as member
8957  * and it can be accessed using this method.
8958  *
8959  * \return pointer to the symbol table
8960  *
8961  * \sa nmodl::symtab::SymbolTable nmodl::visitor::SymtabVisitor
8962  */
8963  symtab::SymbolTable *get_symbol_table() const override { return symtab; }
8964 
8965  /**
8966  * \brief Return name of the node
8967  *
8968  * Some ast nodes have a member marked designated as node name. For example,
8969  * in case of this ast::Name has name designated as a
8970  * node name.
8971  *
8972  * @return name of the node as std::string
8973  *
8974  * \sa Ast::get_node_type_name
8975  */
8976  std::string get_node_name() const override;
8977 
8978  /**
8979  * \brief Getter for member variable \ref DerivativeBlock.name
8980  */
8981  const std::shared_ptr<Name> &get_name() const noexcept { return name; }
8982 
8983  /**
8984  * \brief Getter for member variable \ref DerivativeBlock.statement_block
8985  */
8986  const std::shared_ptr<StatementBlock> &get_statement_block() const
8987  noexcept override {
8988  return statement_block;
8989  }
8990 
8991  /// \}
8992 
8993  /// \name Setters
8994  /// \{
8995 
8996  /**
8997  * \brief Set token for the current ast node
8998  */
8999  void set_token(const ModToken &tok) {
9000  token = std::make_shared<ModToken>(tok);
9001  }
9002 
9003  /**
9004  * \brief Set symbol table for the current ast node
9005  *
9006  * Top level, block scoped nodes store symbol table in the ast node.
9007  * nmodl::visitor::SymtabVisitor then used this method to setup symbol table
9008  * for every node in the ast.
9009  *
9010  * \sa nmodl::visitor::SymtabVisitor
9011  */
9012  void set_symbol_table(symtab::SymbolTable *newsymtab) override {
9013  symtab = newsymtab;
9014  }
9015 
9016  /**
9017  * \brief Setter for member variable \ref DerivativeBlock.name (rvalue
9018  * reference)
9019  */
9020  void set_name(std::shared_ptr<Name> &&name);
9021 
9022  /**
9023  * \brief Setter for member variable \ref DerivativeBlock.name
9024  */
9025  void set_name(const std::shared_ptr<Name> &name);
9026 
9027  /**
9028  * \brief Setter for member variable \ref DerivativeBlock.statement_block
9029  * (rvalue reference)
9030  */
9031  void set_statement_block(std::shared_ptr<StatementBlock> &&statement_block);
9032 
9033  /**
9034  * \brief Setter for member variable \ref DerivativeBlock.statement_block
9035  */
9036  void
9037  set_statement_block(const std::shared_ptr<StatementBlock> &statement_block);
9038 
9039  /// \}
9040 
9041  /// \name Visitor
9042  /// \{
9043 
9044  /**
9045  * \brief visit children i.e. member variables of current node using provided
9046  * visitor
9047  *
9048  * Different nodes in the AST have different members (i.e. children). This
9049  * method recursively visits children using provided visitor.
9050  *
9051  * \param v Concrete visitor that will be used to recursively visit children
9052  *
9053  * \sa Ast::visit_children for example.
9054  */
9055  void visit_children(visitor::Visitor &v) override;
9056 
9057  /**
9058  * \brief visit children i.e. member variables of current node using provided
9059  * visitor
9060  *
9061  * Different nodes in the AST have different members (i.e. children). This
9062  * method recursively visits children using provided visitor.
9063  *
9064  * \param v Concrete constant visitor that will be used to recursively visit
9065  * children
9066  *
9067  * \sa Ast::visit_children for example.
9068  */
9069  void visit_children(visitor::ConstVisitor &v) const override;
9070 
9071  /**
9072  * \brief accept (or visit) the current AST node using provided visitor
9073  *
9074  * Instead of visiting children of AST node, like Ast::visit_children,
9075  * accept allows to visit the current node itself using provided concrete
9076  * visitor.
9077  *
9078  * \param v Concrete visitor that will be used to recursively visit node
9079  *
9080  * \sa Ast::accept for example.
9081  */
9082  void accept(visitor::Visitor &v) override;
9083 
9084  /**
9085  * \copydoc accept(visitor::Visitor&)
9086  */
9087  void accept(visitor::ConstVisitor &v) const override;
9088 
9089  /// \}
9090 
9091 private:
9092  /**
9093  * \brief Set this object as parent for all the children
9094  *
9095  * This should be called in every object (with children) constructor
9096  * to set parents. Since it is called only in the constructors it
9097  * should not be virtual to avoid ambiguities (issue #295).
9098  */
9099  void set_parent_in_children();
9100 };
9101 
9102 /** @} */ // end of ast_class
9103 
9104 } // namespace ast
9105 } // namespace nmodl
9106 #endif // !NMODL_AST_DERIVATIVE_BLOCK_HPP
9107 #ifndef NMODL_AST_LINEAR_BLOCK_HPP
9108 #define NMODL_AST_LINEAR_BLOCK_HPP
9109 
9110 namespace nmodl {
9111 namespace ast {
9112 
9113 /**
9114  * @addtogroup ast_class
9115  * @ingroup ast
9116  * @{
9117  */
9118 
9119 /**
9120  * \brief Represents `LINEAR` block in the NMODL
9121  *
9122  *
9123  * A set of simultaneous equations can be specified in a `LINEAR` block.
9124  * Here is an example :
9125  *
9126  * \code{.mod}
9127  * LINEAR clamp {
9128  * LOCAL t1, t2
9129  * t1 = tau1/dt
9130  * t2 = tau2/dt
9131  * ~ vi = v + fac*vo - fac*v
9132  * ~ t2*vo - t2*vo0 + vo = -gain * e
9133  * ~ -stim - e + vi - e + t1*vi - t1*e - t1*(vi0 - e0) = 0
9134  * }
9135  * \endcode
9136  *
9137  */
9138 class LinearBlock : public Block {
9139 private:
9140  /// Name of the linear block
9141  std::shared_ptr<Name> name;
9142  /// TODO
9144  /// Block with statements vector
9145  std::shared_ptr<StatementBlock> statement_block;
9146  /// token with location information
9147  std::shared_ptr<ModToken> token;
9148  /// symbol table for a block
9149  symtab::SymbolTable *symtab = nullptr;
9150 
9151 public:
9152  /// \name Ctor & dtor
9153  /// \{
9154 
9155  explicit LinearBlock(Name *name, NameVector solvefor,
9156  StatementBlock *statement_block);
9157  explicit LinearBlock(const std::shared_ptr<Name> &name,
9158  const NameVector &solvefor,
9159  const std::shared_ptr<StatementBlock> &statement_block);
9160  LinearBlock(const LinearBlock &obj);
9161 
9162  virtual ~LinearBlock() = default;
9163 
9164  /// \}
9165 
9166  /**
9167  * \brief Check if the ast node is an instance of ast::LinearBlock
9168  * \return true as object is of type ast::LinearBlock
9169  */
9170  bool is_linear_block() const noexcept override { return true; }
9171 
9172  /**
9173  * \brief Return a copy of the current node
9174  *
9175  * Recursively make a new copy/clone of the current node including
9176  * all members and return a pointer to the node. This is used for
9177  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
9178  * ast.
9179  *
9180  * @return pointer to the clone/copy of the current node
9181  */
9182  LinearBlock *clone() const override { return new LinearBlock(*this); }
9183 
9184  /// \name Getters
9185  /// \{
9186 
9187  /**
9188  * \brief Return type (ast::AstNodeType) of ast node
9189  *
9190  * Every node in the ast has a type defined in ast::AstNodeType and this
9191  * function is used to retrieve the same.
9192  *
9193  * \return ast node type i.e. ast::AstNodeType::LINEAR_BLOCK
9194  *
9195  * \sa Ast::get_node_type_name
9196  */
9197  AstNodeType get_node_type() const noexcept override {
9199  }
9200 
9201  /**
9202  * \brief Return type (ast::AstNodeType) of ast node as std::string
9203  *
9204  * Every node in the ast has a type defined in ast::AstNodeType.
9205  * This type name can be returned as a std::string for printing
9206  * node to text/json form.
9207  *
9208  * \return name of the node type as a string i.e. "LinearBlock"
9209  *
9210  * \sa Ast::get_node_name
9211  */
9212  std::string get_node_type_name() const noexcept override {
9213  return "LinearBlock";
9214  }
9215 
9216  /**
9217  * \brief Return NMODL statement of ast node as std::string
9218  *
9219  * Every node is related to a special statement in the NMODL. This
9220  * statement can be returned as a std::string for printing to
9221  * text/json form.
9222  *
9223  * \return name of the statement as a string i.e. "LINEAR "
9224  *
9225  * \sa Ast::get_nmodl_name
9226  */
9227  std::string get_nmodl_name() const noexcept override { return "LINEAR "; }
9228 
9229  /**
9230  * \brief Get std::shared_ptr from `this` pointer of the current ast node
9231  */
9232  std::shared_ptr<Ast> get_shared_ptr() override {
9233  return std::static_pointer_cast<LinearBlock>(shared_from_this());
9234  }
9235 
9236  /**
9237  * \brief Get std::shared_ptr from `this` pointer of the current ast node
9238  */
9239  std::shared_ptr<const Ast> get_shared_ptr() const override {
9240  return std::static_pointer_cast<const LinearBlock>(shared_from_this());
9241  }
9242 
9243  /**
9244  * \brief Return associated token for the current ast node
9245  *
9246  * Not all ast nodes have token information. For example,
9247  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
9248  * solution of ODEs. In this case, we return nullptr to store in the
9249  * nmodl::symtab::SymbolTable.
9250  *
9251  * \return pointer to token if exist otherwise nullptr
9252  */
9253  const ModToken *get_token() const noexcept override { return token.get(); }
9254 
9255  /**
9256  * \brief Return associated symbol table for the current ast node
9257  *
9258  * Only certain ast nodes (e.g. inherited from ast::Block) have associated
9259  * symbol table. These nodes have nmodl::symtab::SymbolTable as member
9260  * and it can be accessed using this method.
9261  *
9262  * \return pointer to the symbol table
9263  *
9264  * \sa nmodl::symtab::SymbolTable nmodl::visitor::SymtabVisitor
9265  */
9266  symtab::SymbolTable *get_symbol_table() const override { return symtab; }
9267 
9268  /**
9269  * \brief Return name of the node
9270  *
9271  * Some ast nodes have a member marked designated as node name. For example,
9272  * in case of this ast::Name has name designated as a
9273  * node name.
9274  *
9275  * @return name of the node as std::string
9276  *
9277  * \sa Ast::get_node_type_name
9278  */
9279  std::string get_node_name() const override;
9280 
9281  /**
9282  * \brief Getter for member variable \ref LinearBlock.name
9283  */
9284  const std::shared_ptr<Name> &get_name() const noexcept { return name; }
9285 
9286  /**
9287  * \brief Getter for member variable \ref LinearBlock.solvefor
9288  */
9289  const NameVector &get_solvefor() const noexcept { return solvefor; }
9290 
9291  /**
9292  * \brief Getter for member variable \ref LinearBlock.statement_block
9293  */
9294  const std::shared_ptr<StatementBlock> &get_statement_block() const
9295  noexcept override {
9296  return statement_block;
9297  }
9298 
9299  /// \}
9300 
9301  /// \name Setters
9302  /// \{
9303 
9304  /**
9305  * \brief Set token for the current ast node
9306  */
9307  void set_token(const ModToken &tok) {
9308  token = std::make_shared<ModToken>(tok);
9309  }
9310 
9311  /**
9312  * \brief Set symbol table for the current ast node
9313  *
9314  * Top level, block scoped nodes store symbol table in the ast node.
9315  * nmodl::visitor::SymtabVisitor then used this method to setup symbol table
9316  * for every node in the ast.
9317  *
9318  * \sa nmodl::visitor::SymtabVisitor
9319  */
9320  void set_symbol_table(symtab::SymbolTable *newsymtab) override {
9321  symtab = newsymtab;
9322  }
9323 
9324  /**
9325  * \brief Setter for member variable \ref LinearBlock.name (rvalue reference)
9326  */
9327  void set_name(std::shared_ptr<Name> &&name);
9328 
9329  /**
9330  * \brief Setter for member variable \ref LinearBlock.name
9331  */
9332  void set_name(const std::shared_ptr<Name> &name);
9333 
9334  /**
9335  * \brief Setter for member variable \ref LinearBlock.solvefor (rvalue
9336  * reference)
9337  */
9338  void set_solvefor(NameVector &&solvefor);
9339 
9340  /**
9341  * \brief Setter for member variable \ref LinearBlock.solvefor
9342  */
9343  void set_solvefor(const NameVector &solvefor);
9344 
9345  /**
9346  * \brief Setter for member variable \ref LinearBlock.statement_block (rvalue
9347  * reference)
9348  */
9349  void set_statement_block(std::shared_ptr<StatementBlock> &&statement_block);
9350 
9351  /**
9352  * \brief Setter for member variable \ref LinearBlock.statement_block
9353  */
9354  void
9355  set_statement_block(const std::shared_ptr<StatementBlock> &statement_block);
9356 
9357  /// \}
9358 
9359  /// \name Visitor
9360  /// \{
9361 
9362  /**
9363  * \brief visit children i.e. member variables of current node using provided
9364  * visitor
9365  *
9366  * Different nodes in the AST have different members (i.e. children). This
9367  * method recursively visits children using provided visitor.
9368  *
9369  * \param v Concrete visitor that will be used to recursively visit children
9370  *
9371  * \sa Ast::visit_children for example.
9372  */
9373  void visit_children(visitor::Visitor &v) override;
9374 
9375  /**
9376  * \brief visit children i.e. member variables of current node using provided
9377  * visitor
9378  *
9379  * Different nodes in the AST have different members (i.e. children). This
9380  * method recursively visits children using provided visitor.
9381  *
9382  * \param v Concrete constant visitor that will be used to recursively visit
9383  * children
9384  *
9385  * \sa Ast::visit_children for example.
9386  */
9387  void visit_children(visitor::ConstVisitor &v) const override;
9388 
9389  /**
9390  * \brief accept (or visit) the current AST node using provided visitor
9391  *
9392  * Instead of visiting children of AST node, like Ast::visit_children,
9393  * accept allows to visit the current node itself using provided concrete
9394  * visitor.
9395  *
9396  * \param v Concrete visitor that will be used to recursively visit node
9397  *
9398  * \sa Ast::accept for example.
9399  */
9400  void accept(visitor::Visitor &v) override;
9401 
9402  /**
9403  * \copydoc accept(visitor::Visitor&)
9404  */
9405  void accept(visitor::ConstVisitor &v) const override;
9406 
9407  /// \}
9408 
9409 private:
9410  /**
9411  * \brief Set this object as parent for all the children
9412  *
9413  * This should be called in every object (with children) constructor
9414  * to set parents. Since it is called only in the constructors it
9415  * should not be virtual to avoid ambiguities (issue #295).
9416  */
9417  void set_parent_in_children();
9418 };
9419 
9420 /** @} */ // end of ast_class
9421 
9422 } // namespace ast
9423 } // namespace nmodl
9424 #endif // !NMODL_AST_LINEAR_BLOCK_HPP
9425 #ifndef NMODL_AST_NON_LINEAR_BLOCK_HPP
9426 #define NMODL_AST_NON_LINEAR_BLOCK_HPP
9427 
9428 namespace nmodl {
9429 namespace ast {
9430 
9431 /**
9432  * @addtogroup ast_class
9433  * @ingroup ast
9434  * @{
9435  */
9436 
9437 /**
9438  * \brief Represents `NONLINEAR` block in the NMODL
9439  *
9440  *
9441  * A set of simultaneous equations can be specified in a `NONLINEAR` block.
9442  * Here is an example :
9443  *
9444  * \code{.mod}
9445  * NONLINEAR nonlin {
9446  * ~ s[0] = 1
9447  * ~ s[1] = 3
9448  * ~ s[2] + s[1] = s[0]
9449  * }
9450  * \endcode
9451  *
9452  */
9453 class NonLinearBlock : public Block {
9454 private:
9455  /// Name of the non-linear block
9456  std::shared_ptr<Name> name;
9457  /// Name of the integration method
9459  /// Block with statements vector
9460  std::shared_ptr<StatementBlock> statement_block;
9461  /// token with location information
9462  std::shared_ptr<ModToken> token;
9463  /// symbol table for a block
9464  symtab::SymbolTable *symtab = nullptr;
9465 
9466 public:
9467  /// \name Ctor & dtor
9468  /// \{
9469 
9470  explicit NonLinearBlock(Name *name, NameVector solvefor,
9471  StatementBlock *statement_block);
9472  explicit NonLinearBlock(
9473  const std::shared_ptr<Name> &name, const NameVector &solvefor,
9474  const std::shared_ptr<StatementBlock> &statement_block);
9475  NonLinearBlock(const NonLinearBlock &obj);
9476 
9477  virtual ~NonLinearBlock() = default;
9478 
9479  /// \}
9480 
9481  /**
9482  * \brief Check if the ast node is an instance of ast::NonLinearBlock
9483  * \return true as object is of type ast::NonLinearBlock
9484  */
9485  bool is_non_linear_block() const noexcept override { return true; }
9486 
9487  /**
9488  * \brief Return a copy of the current node
9489  *
9490  * Recursively make a new copy/clone of the current node including
9491  * all members and return a pointer to the node. This is used for
9492  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
9493  * ast.
9494  *
9495  * @return pointer to the clone/copy of the current node
9496  */
9497  NonLinearBlock *clone() const override { return new NonLinearBlock(*this); }
9498 
9499  /// \name Getters
9500  /// \{
9501 
9502  /**
9503  * \brief Return type (ast::AstNodeType) of ast node
9504  *
9505  * Every node in the ast has a type defined in ast::AstNodeType and this
9506  * function is used to retrieve the same.
9507  *
9508  * \return ast node type i.e. ast::AstNodeType::NON_LINEAR_BLOCK
9509  *
9510  * \sa Ast::get_node_type_name
9511  */
9512  AstNodeType get_node_type() const noexcept override {
9514  }
9515 
9516  /**
9517  * \brief Return type (ast::AstNodeType) of ast node as std::string
9518  *
9519  * Every node in the ast has a type defined in ast::AstNodeType.
9520  * This type name can be returned as a std::string for printing
9521  * node to text/json form.
9522  *
9523  * \return name of the node type as a string i.e. "NonLinearBlock"
9524  *
9525  * \sa Ast::get_node_name
9526  */
9527  std::string get_node_type_name() const noexcept override {
9528  return "NonLinearBlock";
9529  }
9530 
9531  /**
9532  * \brief Return NMODL statement of ast node as std::string
9533  *
9534  * Every node is related to a special statement in the NMODL. This
9535  * statement can be returned as a std::string for printing to
9536  * text/json form.
9537  *
9538  * \return name of the statement as a string i.e. "NONLINEAR "
9539  *
9540  * \sa Ast::get_nmodl_name
9541  */
9542  std::string get_nmodl_name() const noexcept override { return "NONLINEAR "; }
9543 
9544  /**
9545  * \brief Get std::shared_ptr from `this` pointer of the current ast node
9546  */
9547  std::shared_ptr<Ast> get_shared_ptr() override {
9548  return std::static_pointer_cast<NonLinearBlock>(shared_from_this());
9549  }
9550 
9551  /**
9552  * \brief Get std::shared_ptr from `this` pointer of the current ast node
9553  */
9554  std::shared_ptr<const Ast> get_shared_ptr() const override {
9555  return std::static_pointer_cast<const NonLinearBlock>(shared_from_this());
9556  }
9557 
9558  /**
9559  * \brief Return associated token for the current ast node
9560  *
9561  * Not all ast nodes have token information. For example,
9562  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
9563  * solution of ODEs. In this case, we return nullptr to store in the
9564  * nmodl::symtab::SymbolTable.
9565  *
9566  * \return pointer to token if exist otherwise nullptr
9567  */
9568  const ModToken *get_token() const noexcept override { return token.get(); }
9569 
9570  /**
9571  * \brief Return associated symbol table for the current ast node
9572  *
9573  * Only certain ast nodes (e.g. inherited from ast::Block) have associated
9574  * symbol table. These nodes have nmodl::symtab::SymbolTable as member
9575  * and it can be accessed using this method.
9576  *
9577  * \return pointer to the symbol table
9578  *
9579  * \sa nmodl::symtab::SymbolTable nmodl::visitor::SymtabVisitor
9580  */
9581  symtab::SymbolTable *get_symbol_table() const override { return symtab; }
9582 
9583  /**
9584  * \brief Return name of the node
9585  *
9586  * Some ast nodes have a member marked designated as node name. For example,
9587  * in case of this ast::Name has name designated as a
9588  * node name.
9589  *
9590  * @return name of the node as std::string
9591  *
9592  * \sa Ast::get_node_type_name
9593  */
9594  std::string get_node_name() const override;
9595 
9596  /**
9597  * \brief Getter for member variable \ref NonLinearBlock.name
9598  */
9599  const std::shared_ptr<Name> &get_name() const noexcept { return name; }
9600 
9601  /**
9602  * \brief Getter for member variable \ref NonLinearBlock.solvefor
9603  */
9604  const NameVector &get_solvefor() const noexcept { return solvefor; }
9605 
9606  /**
9607  * \brief Getter for member variable \ref NonLinearBlock.statement_block
9608  */
9609  const std::shared_ptr<StatementBlock> &get_statement_block() const
9610  noexcept override {
9611  return statement_block;
9612  }
9613 
9614  /// \}
9615 
9616  /// \name Setters
9617  /// \{
9618 
9619  /**
9620  * \brief Set token for the current ast node
9621  */
9622  void set_token(const ModToken &tok) {
9623  token = std::make_shared<ModToken>(tok);
9624  }
9625 
9626  /**
9627  * \brief Set symbol table for the current ast node
9628  *
9629  * Top level, block scoped nodes store symbol table in the ast node.
9630  * nmodl::visitor::SymtabVisitor then used this method to setup symbol table
9631  * for every node in the ast.
9632  *
9633  * \sa nmodl::visitor::SymtabVisitor
9634  */
9635  void set_symbol_table(symtab::SymbolTable *newsymtab) override {
9636  symtab = newsymtab;
9637  }
9638 
9639  /**
9640  * \brief Setter for member variable \ref NonLinearBlock.name (rvalue
9641  * reference)
9642  */
9643  void set_name(std::shared_ptr<Name> &&name);
9644 
9645  /**
9646  * \brief Setter for member variable \ref NonLinearBlock.name
9647  */
9648  void set_name(const std::shared_ptr<Name> &name);
9649 
9650  /**
9651  * \brief Setter for member variable \ref NonLinearBlock.solvefor (rvalue
9652  * reference)
9653  */
9654  void set_solvefor(NameVector &&solvefor);
9655 
9656  /**
9657  * \brief Setter for member variable \ref NonLinearBlock.solvefor
9658  */
9659  void set_solvefor(const NameVector &solvefor);
9660 
9661  /**
9662  * \brief Setter for member variable \ref NonLinearBlock.statement_block
9663  * (rvalue reference)
9664  */
9665  void set_statement_block(std::shared_ptr<StatementBlock> &&statement_block);
9666 
9667  /**
9668  * \brief Setter for member variable \ref NonLinearBlock.statement_block
9669  */
9670  void
9671  set_statement_block(const std::shared_ptr<StatementBlock> &statement_block);
9672 
9673  /// \}
9674 
9675  /// \name Visitor
9676  /// \{
9677 
9678  /**
9679  * \brief visit children i.e. member variables of current node using provided
9680  * visitor
9681  *
9682  * Different nodes in the AST have different members (i.e. children). This
9683  * method recursively visits children using provided visitor.
9684  *
9685  * \param v Concrete visitor that will be used to recursively visit children
9686  *
9687  * \sa Ast::visit_children for example.
9688  */
9689  void visit_children(visitor::Visitor &v) override;
9690 
9691  /**
9692  * \brief visit children i.e. member variables of current node using provided
9693  * visitor
9694  *
9695  * Different nodes in the AST have different members (i.e. children). This
9696  * method recursively visits children using provided visitor.
9697  *
9698  * \param v Concrete constant visitor that will be used to recursively visit
9699  * children
9700  *
9701  * \sa Ast::visit_children for example.
9702  */
9703  void visit_children(visitor::ConstVisitor &v) const override;
9704 
9705  /**
9706  * \brief accept (or visit) the current AST node using provided visitor
9707  *
9708  * Instead of visiting children of AST node, like Ast::visit_children,
9709  * accept allows to visit the current node itself using provided concrete
9710  * visitor.
9711  *
9712  * \param v Concrete visitor that will be used to recursively visit node
9713  *
9714  * \sa Ast::accept for example.
9715  */
9716  void accept(visitor::Visitor &v) override;
9717 
9718  /**
9719  * \copydoc accept(visitor::Visitor&)
9720  */
9721  void accept(visitor::ConstVisitor &v) const override;
9722 
9723  /// \}
9724 
9725 private:
9726  /**
9727  * \brief Set this object as parent for all the children
9728  *
9729  * This should be called in every object (with children) constructor
9730  * to set parents. Since it is called only in the constructors it
9731  * should not be virtual to avoid ambiguities (issue #295).
9732  */
9733  void set_parent_in_children();
9734 };
9735 
9736 /** @} */ // end of ast_class
9737 
9738 } // namespace ast
9739 } // namespace nmodl
9740 #endif // !NMODL_AST_NON_LINEAR_BLOCK_HPP
9741 #ifndef NMODL_AST_DISCRETE_BLOCK_HPP
9742 #define NMODL_AST_DISCRETE_BLOCK_HPP
9743 
9744 namespace nmodl {
9745 namespace ast {
9746 
9747 /**
9748  * @addtogroup ast_class
9749  * @ingroup ast
9750  * @{
9751  */
9752 
9753 /**
9754  * \brief TODO
9755  *
9756  *
9757  */
9758 class DiscreteBlock : public Block {
9759 private:
9760  /// Name of the discrete block
9761  std::shared_ptr<Name> name;
9762  /// Block with statements vector
9763  std::shared_ptr<StatementBlock> statement_block;
9764  /// token with location information
9765  std::shared_ptr<ModToken> token;
9766  /// symbol table for a block
9767  symtab::SymbolTable *symtab = nullptr;
9768 
9769 public:
9770  /// \name Ctor & dtor
9771  /// \{
9772 
9773  explicit DiscreteBlock(Name *name, StatementBlock *statement_block);
9774  explicit DiscreteBlock(
9775  const std::shared_ptr<Name> &name,
9776  const std::shared_ptr<StatementBlock> &statement_block);
9777  DiscreteBlock(const DiscreteBlock &obj);
9778 
9779  virtual ~DiscreteBlock() = default;
9780 
9781  /// \}
9782 
9783  /**
9784  * \brief Check if the ast node is an instance of ast::DiscreteBlock
9785  * \return true as object is of type ast::DiscreteBlock
9786  */
9787  bool is_discrete_block() const noexcept override { return true; }
9788 
9789  /**
9790  * \brief Return a copy of the current node
9791  *
9792  * Recursively make a new copy/clone of the current node including
9793  * all members and return a pointer to the node. This is used for
9794  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
9795  * ast.
9796  *
9797  * @return pointer to the clone/copy of the current node
9798  */
9799  DiscreteBlock *clone() const override { return new DiscreteBlock(*this); }
9800 
9801  /// \name Getters
9802  /// \{
9803 
9804  /**
9805  * \brief Return type (ast::AstNodeType) of ast node
9806  *
9807  * Every node in the ast has a type defined in ast::AstNodeType and this
9808  * function is used to retrieve the same.
9809  *
9810  * \return ast node type i.e. ast::AstNodeType::DISCRETE_BLOCK
9811  *
9812  * \sa Ast::get_node_type_name
9813  */
9814  AstNodeType get_node_type() const noexcept override {
9816  }
9817 
9818  /**
9819  * \brief Return type (ast::AstNodeType) of ast node as std::string
9820  *
9821  * Every node in the ast has a type defined in ast::AstNodeType.
9822  * This type name can be returned as a std::string for printing
9823  * node to text/json form.
9824  *
9825  * \return name of the node type as a string i.e. "DiscreteBlock"
9826  *
9827  * \sa Ast::get_node_name
9828  */
9829  std::string get_node_type_name() const noexcept override {
9830  return "DiscreteBlock";
9831  }
9832 
9833  /**
9834  * \brief Return NMODL statement of ast node as std::string
9835  *
9836  * Every node is related to a special statement in the NMODL. This
9837  * statement can be returned as a std::string for printing to
9838  * text/json form.
9839  *
9840  * \return name of the statement as a string i.e. "DISCRETE "
9841  *
9842  * \sa Ast::get_nmodl_name
9843  */
9844  std::string get_nmodl_name() const noexcept override { return "DISCRETE "; }
9845 
9846  /**
9847  * \brief Get std::shared_ptr from `this` pointer of the current ast node
9848  */
9849  std::shared_ptr<Ast> get_shared_ptr() override {
9850  return std::static_pointer_cast<DiscreteBlock>(shared_from_this());
9851  }
9852 
9853  /**
9854  * \brief Get std::shared_ptr from `this` pointer of the current ast node
9855  */
9856  std::shared_ptr<const Ast> get_shared_ptr() const override {
9857  return std::static_pointer_cast<const DiscreteBlock>(shared_from_this());
9858  }
9859 
9860  /**
9861  * \brief Return associated token for the current ast node
9862  *
9863  * Not all ast nodes have token information. For example,
9864  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
9865  * solution of ODEs. In this case, we return nullptr to store in the
9866  * nmodl::symtab::SymbolTable.
9867  *
9868  * \return pointer to token if exist otherwise nullptr
9869  */
9870  const ModToken *get_token() const noexcept override { return token.get(); }
9871 
9872  /**
9873  * \brief Return associated symbol table for the current ast node
9874  *
9875  * Only certain ast nodes (e.g. inherited from ast::Block) have associated
9876  * symbol table. These nodes have nmodl::symtab::SymbolTable as member
9877  * and it can be accessed using this method.
9878  *
9879  * \return pointer to the symbol table
9880  *
9881  * \sa nmodl::symtab::SymbolTable nmodl::visitor::SymtabVisitor
9882  */
9883  symtab::SymbolTable *get_symbol_table() const override { return symtab; }
9884 
9885  /**
9886  * \brief Return name of the node
9887  *
9888  * Some ast nodes have a member marked designated as node name. For example,
9889  * in case of this ast::Name has name designated as a
9890  * node name.
9891  *
9892  * @return name of the node as std::string
9893  *
9894  * \sa Ast::get_node_type_name
9895  */
9896  std::string get_node_name() const override;
9897 
9898  /**
9899  * \brief Getter for member variable \ref DiscreteBlock.name
9900  */
9901  const std::shared_ptr<Name> &get_name() const noexcept { return name; }
9902 
9903  /**
9904  * \brief Getter for member variable \ref DiscreteBlock.statement_block
9905  */
9906  const std::shared_ptr<StatementBlock> &get_statement_block() const
9907  noexcept override {
9908  return statement_block;
9909  }
9910 
9911  /// \}
9912 
9913  /// \name Setters
9914  /// \{
9915 
9916  /**
9917  * \brief Set token for the current ast node
9918  */
9919  void set_token(const ModToken &tok) {
9920  token = std::make_shared<ModToken>(tok);
9921  }
9922 
9923  /**
9924  * \brief Set symbol table for the current ast node
9925  *
9926  * Top level, block scoped nodes store symbol table in the ast node.
9927  * nmodl::visitor::SymtabVisitor then used this method to setup symbol table
9928  * for every node in the ast.
9929  *
9930  * \sa nmodl::visitor::SymtabVisitor
9931  */
9932  void set_symbol_table(symtab::SymbolTable *newsymtab) override {
9933  symtab = newsymtab;
9934  }
9935 
9936  /**
9937  * \brief Setter for member variable \ref DiscreteBlock.name (rvalue
9938  * reference)
9939  */
9940  void set_name(std::shared_ptr<Name> &&name);
9941 
9942  /**
9943  * \brief Setter for member variable \ref DiscreteBlock.name
9944  */
9945  void set_name(const std::shared_ptr<Name> &name);
9946 
9947  /**
9948  * \brief Setter for member variable \ref DiscreteBlock.statement_block
9949  * (rvalue reference)
9950  */
9951  void set_statement_block(std::shared_ptr<StatementBlock> &&statement_block);
9952 
9953  /**
9954  * \brief Setter for member variable \ref DiscreteBlock.statement_block
9955  */
9956  void
9957  set_statement_block(const std::shared_ptr<StatementBlock> &statement_block);
9958 
9959  /// \}
9960 
9961  /// \name Visitor
9962  /// \{
9963 
9964  /**
9965  * \brief visit children i.e. member variables of current node using provided
9966  * visitor
9967  *
9968  * Different nodes in the AST have different members (i.e. children). This
9969  * method recursively visits children using provided visitor.
9970  *
9971  * \param v Concrete visitor that will be used to recursively visit children
9972  *
9973  * \sa Ast::visit_children for example.
9974  */
9975  void visit_children(visitor::Visitor &v) override;
9976 
9977  /**
9978  * \brief visit children i.e. member variables of current node using provided
9979  * visitor
9980  *
9981  * Different nodes in the AST have different members (i.e. children). This
9982  * method recursively visits children using provided visitor.
9983  *
9984  * \param v Concrete constant visitor that will be used to recursively visit
9985  * children
9986  *
9987  * \sa Ast::visit_children for example.
9988  */
9989  void visit_children(visitor::ConstVisitor &v) const override;
9990 
9991  /**
9992  * \brief accept (or visit) the current AST node using provided visitor
9993  *
9994  * Instead of visiting children of AST node, like Ast::visit_children,
9995  * accept allows to visit the current node itself using provided concrete
9996  * visitor.
9997  *
9998  * \param v Concrete visitor that will be used to recursively visit node
9999  *
10000  * \sa Ast::accept for example.
10001  */
10002  void accept(visitor::Visitor &v) override;
10003 
10004  /**
10005  * \copydoc accept(visitor::Visitor&)
10006  */
10007  void accept(visitor::ConstVisitor &v) const override;
10008 
10009  /// \}
10010 
10011 private:
10012  /**
10013  * \brief Set this object as parent for all the children
10014  *
10015  * This should be called in every object (with children) constructor
10016  * to set parents. Since it is called only in the constructors it
10017  * should not be virtual to avoid ambiguities (issue #295).
10018  */
10019  void set_parent_in_children();
10020 };
10021 
10022 /** @} */ // end of ast_class
10023 
10024 } // namespace ast
10025 } // namespace nmodl
10026 #endif // !NMODL_AST_DISCRETE_BLOCK_HPP
10027 #ifndef NMODL_AST_PARTIAL_BLOCK_HPP
10028 #define NMODL_AST_PARTIAL_BLOCK_HPP
10029 
10030 namespace nmodl {
10031 namespace ast {
10032 
10033 /**
10034  * @addtogroup ast_class
10035  * @ingroup ast
10036  * @{
10037  */
10038 
10039 /**
10040  * \brief TODO
10041  *
10042  *
10043  */
10044 class PartialBlock : public Block {
10045 private:
10046  /// Name of the partial block
10047  std::shared_ptr<Name> name;
10048  /// Block with statements vector
10049  std::shared_ptr<StatementBlock> statement_block;
10050  /// token with location information
10051  std::shared_ptr<ModToken> token;
10052  /// symbol table for a block
10053  symtab::SymbolTable *symtab = nullptr;
10054 
10055 public:
10056  /// \name Ctor & dtor
10057  /// \{
10058 
10059  explicit PartialBlock(Name *name, StatementBlock *statement_block);
10060  explicit PartialBlock(const std::shared_ptr<Name> &name,
10061  const std::shared_ptr<StatementBlock> &statement_block);
10062  PartialBlock(const PartialBlock &obj);
10063 
10064  virtual ~PartialBlock() = default;
10065 
10066  /// \}
10067 
10068  /**
10069  * \brief Check if the ast node is an instance of ast::PartialBlock
10070  * \return true as object is of type ast::PartialBlock
10071  */
10072  bool is_partial_block() const noexcept override { return true; }
10073 
10074  /**
10075  * \brief Return a copy of the current node
10076  *
10077  * Recursively make a new copy/clone of the current node including
10078  * all members and return a pointer to the node. This is used for
10079  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
10080  * ast.
10081  *
10082  * @return pointer to the clone/copy of the current node
10083  */
10084  PartialBlock *clone() const override { return new PartialBlock(*this); }
10085 
10086  /// \name Getters
10087  /// \{
10088 
10089  /**
10090  * \brief Return type (ast::AstNodeType) of ast node
10091  *
10092  * Every node in the ast has a type defined in ast::AstNodeType and this
10093  * function is used to retrieve the same.
10094  *
10095  * \return ast node type i.e. ast::AstNodeType::PARTIAL_BLOCK
10096  *
10097  * \sa Ast::get_node_type_name
10098  */
10099  AstNodeType get_node_type() const noexcept override {
10101  }
10102 
10103  /**
10104  * \brief Return type (ast::AstNodeType) of ast node as std::string
10105  *
10106  * Every node in the ast has a type defined in ast::AstNodeType.
10107  * This type name can be returned as a std::string for printing
10108  * node to text/json form.
10109  *
10110  * \return name of the node type as a string i.e. "PartialBlock"
10111  *
10112  * \sa Ast::get_node_name
10113  */
10114  std::string get_node_type_name() const noexcept override {
10115  return "PartialBlock";
10116  }
10117 
10118  /**
10119  * \brief Return NMODL statement of ast node as std::string
10120  *
10121  * Every node is related to a special statement in the NMODL. This
10122  * statement can be returned as a std::string for printing to
10123  * text/json form.
10124  *
10125  * \return name of the statement as a string i.e. "PARTIAL "
10126  *
10127  * \sa Ast::get_nmodl_name
10128  */
10129  std::string get_nmodl_name() const noexcept override { return "PARTIAL "; }
10130 
10131  /**
10132  * \brief Get std::shared_ptr from `this` pointer of the current ast node
10133  */
10134  std::shared_ptr<Ast> get_shared_ptr() override {
10135  return std::static_pointer_cast<PartialBlock>(shared_from_this());
10136  }
10137 
10138  /**
10139  * \brief Get std::shared_ptr from `this` pointer of the current ast node
10140  */
10141  std::shared_ptr<const Ast> get_shared_ptr() const override {
10142  return std::static_pointer_cast<const PartialBlock>(shared_from_this());
10143  }
10144 
10145  /**
10146  * \brief Return associated token for the current ast node
10147  *
10148  * Not all ast nodes have token information. For example,
10149  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
10150  * solution of ODEs. In this case, we return nullptr to store in the
10151  * nmodl::symtab::SymbolTable.
10152  *
10153  * \return pointer to token if exist otherwise nullptr
10154  */
10155  const ModToken *get_token() const noexcept override { return token.get(); }
10156 
10157  /**
10158  * \brief Return associated symbol table for the current ast node
10159  *
10160  * Only certain ast nodes (e.g. inherited from ast::Block) have associated
10161  * symbol table. These nodes have nmodl::symtab::SymbolTable as member
10162  * and it can be accessed using this method.
10163  *
10164  * \return pointer to the symbol table
10165  *
10166  * \sa nmodl::symtab::SymbolTable nmodl::visitor::SymtabVisitor
10167  */
10168  symtab::SymbolTable *get_symbol_table() const override { return symtab; }
10169 
10170  /**
10171  * \brief Return name of the node
10172  *
10173  * Some ast nodes have a member marked designated as node name. For example,
10174  * in case of this ast::Name has name designated as a
10175  * node name.
10176  *
10177  * @return name of the node as std::string
10178  *
10179  * \sa Ast::get_node_type_name
10180  */
10181  std::string get_node_name() const override;
10182 
10183  /**
10184  * \brief Getter for member variable \ref PartialBlock.name
10185  */
10186  const std::shared_ptr<Name> &get_name() const noexcept { return name; }
10187 
10188  /**
10189  * \brief Getter for member variable \ref PartialBlock.statement_block
10190  */
10191  const std::shared_ptr<StatementBlock> &get_statement_block() const
10192  noexcept override {
10193  return statement_block;
10194  }
10195 
10196  /// \}
10197 
10198  /// \name Setters
10199  /// \{
10200 
10201  /**
10202  * \brief Set token for the current ast node
10203  */
10204  void set_token(const ModToken &tok) {
10205  token = std::make_shared<ModToken>(tok);
10206  }
10207 
10208  /**
10209  * \brief Set symbol table for the current ast node
10210  *
10211  * Top level, block scoped nodes store symbol table in the ast node.
10212  * nmodl::visitor::SymtabVisitor then used this method to setup symbol table
10213  * for every node in the ast.
10214  *
10215  * \sa nmodl::visitor::SymtabVisitor
10216  */
10217  void set_symbol_table(symtab::SymbolTable *newsymtab) override {
10218  symtab = newsymtab;
10219  }
10220 
10221  /**
10222  * \brief Setter for member variable \ref PartialBlock.name (rvalue reference)
10223  */
10224  void set_name(std::shared_ptr<Name> &&name);
10225 
10226  /**
10227  * \brief Setter for member variable \ref PartialBlock.name
10228  */
10229  void set_name(const std::shared_ptr<Name> &name);
10230 
10231  /**
10232  * \brief Setter for member variable \ref PartialBlock.statement_block (rvalue
10233  * reference)
10234  */
10235  void set_statement_block(std::shared_ptr<StatementBlock> &&statement_block);
10236 
10237  /**
10238  * \brief Setter for member variable \ref PartialBlock.statement_block
10239  */
10240  void
10241  set_statement_block(const std::shared_ptr<StatementBlock> &statement_block);
10242 
10243  /// \}
10244 
10245  /// \name Visitor
10246  /// \{
10247 
10248  /**
10249  * \brief visit children i.e. member variables of current node using provided
10250  * visitor
10251  *
10252  * Different nodes in the AST have different members (i.e. children). This
10253  * method recursively visits children using provided visitor.
10254  *
10255  * \param v Concrete visitor that will be used to recursively visit children
10256  *
10257  * \sa Ast::visit_children for example.
10258  */
10259  void visit_children(visitor::Visitor &v) override;
10260 
10261  /**
10262  * \brief visit children i.e. member variables of current node using provided
10263  * visitor
10264  *
10265  * Different nodes in the AST have different members (i.e. children). This
10266  * method recursively visits children using provided visitor.
10267  *
10268  * \param v Concrete constant visitor that will be used to recursively visit
10269  * children
10270  *
10271  * \sa Ast::visit_children for example.
10272  */
10273  void visit_children(visitor::ConstVisitor &v) const override;
10274 
10275  /**
10276  * \brief accept (or visit) the current AST node using provided visitor
10277  *
10278  * Instead of visiting children of AST node, like Ast::visit_children,
10279  * accept allows to visit the current node itself using provided concrete
10280  * visitor.
10281  *
10282  * \param v Concrete visitor that will be used to recursively visit node
10283  *
10284  * \sa Ast::accept for example.
10285  */
10286  void accept(visitor::Visitor &v) override;
10287 
10288  /**
10289  * \copydoc accept(visitor::Visitor&)
10290  */
10291  void accept(visitor::ConstVisitor &v) const override;
10292 
10293  /// \}
10294 
10295 private:
10296  /**
10297  * \brief Set this object as parent for all the children
10298  *
10299  * This should be called in every object (with children) constructor
10300  * to set parents. Since it is called only in the constructors it
10301  * should not be virtual to avoid ambiguities (issue #295).
10302  */
10303  void set_parent_in_children();
10304 };
10305 
10306 /** @} */ // end of ast_class
10307 
10308 } // namespace ast
10309 } // namespace nmodl
10310 #endif // !NMODL_AST_PARTIAL_BLOCK_HPP
10311 #ifndef NMODL_AST_FUNCTION_TABLE_BLOCK_HPP
10312 #define NMODL_AST_FUNCTION_TABLE_BLOCK_HPP
10313 
10314 namespace nmodl {
10315 namespace ast {
10316 
10317 /**
10318  * @addtogroup ast_class
10319  * @ingroup ast
10320  * @{
10321  */
10322 
10323 /**
10324  * \brief TODO
10325  *
10326  *
10327  */
10328 class FunctionTableBlock : public Block {
10329 private:
10330  /// Name of the function table block
10331  std::shared_ptr<Name> name;
10332  /// Vector of the parameters
10334  /// Unit if specified
10335  std::shared_ptr<Unit> unit;
10336  /// token with location information
10337  std::shared_ptr<ModToken> token;
10338  /// symbol table for a block
10339  symtab::SymbolTable *symtab = nullptr;
10340 
10341 public:
10342  /// \name Ctor & dtor
10343  /// \{
10344 
10345  explicit FunctionTableBlock(Name *name, ArgumentVector parameters,
10346  Unit *unit);
10347  explicit FunctionTableBlock(const std::shared_ptr<Name> &name,
10348  const ArgumentVector &parameters,
10349  const std::shared_ptr<Unit> &unit);
10351 
10352  virtual ~FunctionTableBlock() = default;
10353 
10354  /// \}
10355 
10356  /**
10357  * \brief Check if the ast node is an instance of ast::FunctionTableBlock
10358  * \return true as object is of type ast::FunctionTableBlock
10359  */
10360  bool is_function_table_block() const noexcept override { return true; }
10361 
10362  /**
10363  * \brief Return a copy of the current node
10364  *
10365  * Recursively make a new copy/clone of the current node including
10366  * all members and return a pointer to the node. This is used for
10367  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
10368  * ast.
10369  *
10370  * @return pointer to the clone/copy of the current node
10371  */
10372  FunctionTableBlock *clone() const override {
10373  return new FunctionTableBlock(*this);
10374  }
10375 
10376  /// \name Getters
10377  /// \{
10378 
10379  /**
10380  * \brief Return type (ast::AstNodeType) of ast node
10381  *
10382  * Every node in the ast has a type defined in ast::AstNodeType and this
10383  * function is used to retrieve the same.
10384  *
10385  * \return ast node type i.e. ast::AstNodeType::FUNCTION_TABLE_BLOCK
10386  *
10387  * \sa Ast::get_node_type_name
10388  */
10389  AstNodeType get_node_type() const noexcept override {
10391  }
10392 
10393  /**
10394  * \brief Return type (ast::AstNodeType) of ast node as std::string
10395  *
10396  * Every node in the ast has a type defined in ast::AstNodeType.
10397  * This type name can be returned as a std::string for printing
10398  * node to text/json form.
10399  *
10400  * \return name of the node type as a string i.e. "FunctionTableBlock"
10401  *
10402  * \sa Ast::get_node_name
10403  */
10404  std::string get_node_type_name() const noexcept override {
10405  return "FunctionTableBlock";
10406  }
10407 
10408  /**
10409  * \brief Return NMODL statement of ast node as std::string
10410  *
10411  * Every node is related to a special statement in the NMODL. This
10412  * statement can be returned as a std::string for printing to
10413  * text/json form.
10414  *
10415  * \return name of the statement as a string i.e. "FUNCTION_TABLE "
10416  *
10417  * \sa Ast::get_nmodl_name
10418  */
10419  std::string get_nmodl_name() const noexcept override {
10420  return "FUNCTION_TABLE ";
10421  }
10422 
10423  /**
10424  * \brief Get std::shared_ptr from `this` pointer of the current ast node
10425  */
10426  std::shared_ptr<Ast> get_shared_ptr() override {
10427  return std::static_pointer_cast<FunctionTableBlock>(shared_from_this());
10428  }
10429 
10430  /**
10431  * \brief Get std::shared_ptr from `this` pointer of the current ast node
10432  */
10433  std::shared_ptr<const Ast> get_shared_ptr() const override {
10434  return std::static_pointer_cast<const FunctionTableBlock>(
10435  shared_from_this());
10436  }
10437 
10438  /**
10439  * \brief Return associated token for the current ast node
10440  *
10441  * Not all ast nodes have token information. For example,
10442  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
10443  * solution of ODEs. In this case, we return nullptr to store in the
10444  * nmodl::symtab::SymbolTable.
10445  *
10446  * \return pointer to token if exist otherwise nullptr
10447  */
10448  const ModToken *get_token() const noexcept override { return token.get(); }
10449 
10450  /**
10451  * \brief Return associated symbol table for the current ast node
10452  *
10453  * Only certain ast nodes (e.g. inherited from ast::Block) have associated
10454  * symbol table. These nodes have nmodl::symtab::SymbolTable as member
10455  * and it can be accessed using this method.
10456  *
10457  * \return pointer to the symbol table
10458  *
10459  * \sa nmodl::symtab::SymbolTable nmodl::visitor::SymtabVisitor
10460  */
10461  symtab::SymbolTable *get_symbol_table() const override { return symtab; }
10462 
10463  /**
10464  * \brief Return name of the node
10465  *
10466  * Some ast nodes have a member marked designated as node name. For example,
10467  * in case of this ast::Name has name designated as a
10468  * node name.
10469  *
10470  * @return name of the node as std::string
10471  *
10472  * \sa Ast::get_node_type_name
10473  */
10474  std::string get_node_name() const override;
10475 
10476  /**
10477  * \brief Getter for member variable \ref FunctionTableBlock.name
10478  */
10479  const std::shared_ptr<Name> &get_name() const noexcept { return name; }
10480 
10481  /**
10482  * \brief Getter for member variable \ref FunctionTableBlock.parameters
10483  */
10484  const ArgumentVector &get_parameters() const noexcept override {
10485  return parameters;
10486  }
10487 
10488  /**
10489  * \brief Getter for member variable \ref FunctionTableBlock.unit
10490  */
10491  const std::shared_ptr<Unit> &get_unit() const noexcept { return unit; }
10492 
10493  /// \}
10494 
10495  /// \name Setters
10496  /// \{
10497 
10498  /**
10499  * \brief Set token for the current ast node
10500  */
10501  void set_token(const ModToken &tok) {
10502  token = std::make_shared<ModToken>(tok);
10503  }
10504 
10505  /**
10506  * \brief Set symbol table for the current ast node
10507  *
10508  * Top level, block scoped nodes store symbol table in the ast node.
10509  * nmodl::visitor::SymtabVisitor then used this method to setup symbol table
10510  * for every node in the ast.
10511  *
10512  * \sa nmodl::visitor::SymtabVisitor
10513  */
10514  void set_symbol_table(symtab::SymbolTable *newsymtab) override {
10515  symtab = newsymtab;
10516  }
10517 
10518  /**
10519  * \brief Setter for member variable \ref FunctionTableBlock.name (rvalue
10520  * reference)
10521  */
10522  void set_name(std::shared_ptr<Name> &&name);
10523 
10524  /**
10525  * \brief Setter for member variable \ref FunctionTableBlock.name
10526  */
10527  void set_name(const std::shared_ptr<Name> &name);
10528 
10529  /**
10530  * \brief Setter for member variable \ref FunctionTableBlock.parameters
10531  * (rvalue reference)
10532  */
10533  void set_parameters(ArgumentVector &&parameters);
10534 
10535  /**
10536  * \brief Setter for member variable \ref FunctionTableBlock.parameters
10537  */
10538  void set_parameters(const ArgumentVector &parameters);
10539 
10540  /**
10541  * \brief Setter for member variable \ref FunctionTableBlock.unit (rvalue
10542  * reference)
10543  */
10544  void set_unit(std::shared_ptr<Unit> &&unit);
10545 
10546  /**
10547  * \brief Setter for member variable \ref FunctionTableBlock.unit
10548  */
10549  void set_unit(const std::shared_ptr<Unit> &unit);
10550 
10551  /// \}
10552 
10553  /// \name Visitor
10554  /// \{
10555 
10556  /**
10557  * \brief visit children i.e. member variables of current node using provided
10558  * visitor
10559  *
10560  * Different nodes in the AST have different members (i.e. children). This
10561  * method recursively visits children using provided visitor.
10562  *
10563  * \param v Concrete visitor that will be used to recursively visit children
10564  *
10565  * \sa Ast::visit_children for example.
10566  */
10567  void visit_children(visitor::Visitor &v) override;
10568 
10569  /**
10570  * \brief visit children i.e. member variables of current node using provided
10571  * visitor
10572  *
10573  * Different nodes in the AST have different members (i.e. children). This
10574  * method recursively visits children using provided visitor.
10575  *
10576  * \param v Concrete constant visitor that will be used to recursively visit
10577  * children
10578  *
10579  * \sa Ast::visit_children for example.
10580  */
10581  void visit_children(visitor::ConstVisitor &v) const override;
10582 
10583  /**
10584  * \brief accept (or visit) the current AST node using provided visitor
10585  *
10586  * Instead of visiting children of AST node, like Ast::visit_children,
10587  * accept allows to visit the current node itself using provided concrete
10588  * visitor.
10589  *
10590  * \param v Concrete visitor that will be used to recursively visit node
10591  *
10592  * \sa Ast::accept for example.
10593  */
10594  void accept(visitor::Visitor &v) override;
10595 
10596  /**
10597  * \copydoc accept(visitor::Visitor&)
10598  */
10599  void accept(visitor::ConstVisitor &v) const override;
10600 
10601  /// \}
10602 
10603 private:
10604  /**
10605  * \brief Set this object as parent for all the children
10606  *
10607  * This should be called in every object (with children) constructor
10608  * to set parents. Since it is called only in the constructors it
10609  * should not be virtual to avoid ambiguities (issue #295).
10610  */
10611  void set_parent_in_children();
10612 };
10613 
10614 /** @} */ // end of ast_class
10615 
10616 } // namespace ast
10617 } // namespace nmodl
10618 #endif // !NMODL_AST_FUNCTION_TABLE_BLOCK_HPP
10619 #ifndef NMODL_AST_FUNCTION_BLOCK_HPP
10620 #define NMODL_AST_FUNCTION_BLOCK_HPP
10621 
10622 namespace nmodl {
10623 namespace ast {
10624 
10625 /**
10626  * @addtogroup ast_class
10627  * @ingroup ast
10628  * @{
10629  */
10630 
10631 /**
10632  * \brief TODO
10633  *
10634  *
10635  */
10636 class FunctionBlock : public Block {
10637 private:
10638  /// Name of the function
10639  std::shared_ptr<Name> name;
10640  /// Vector of the parameters
10642  /// Unit if specified
10643  std::shared_ptr<Unit> unit;
10644  /// Block with statements vector
10645  std::shared_ptr<StatementBlock> statement_block;
10646  /// token with location information
10647  std::shared_ptr<ModToken> token;
10648  /// symbol table for a block
10649  symtab::SymbolTable *symtab = nullptr;
10650 
10651 public:
10652  /// \name Ctor & dtor
10653  /// \{
10654 
10655  explicit FunctionBlock(Name *name, ArgumentVector parameters, Unit *unit,
10656  StatementBlock *statement_block);
10657  explicit FunctionBlock(
10658  const std::shared_ptr<Name> &name, const ArgumentVector &parameters,
10659  const std::shared_ptr<Unit> &unit,
10660  const std::shared_ptr<StatementBlock> &statement_block);
10661  FunctionBlock(const FunctionBlock &obj);
10662 
10663  virtual ~FunctionBlock() = default;
10664 
10665  /// \}
10666 
10667  /**
10668  * \brief Check if the ast node is an instance of ast::FunctionBlock
10669  * \return true as object is of type ast::FunctionBlock
10670  */
10671  bool is_function_block() const noexcept override { return true; }
10672 
10673  /**
10674  * \brief Return a copy of the current node
10675  *
10676  * Recursively make a new copy/clone of the current node including
10677  * all members and return a pointer to the node. This is used for
10678  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
10679  * ast.
10680  *
10681  * @return pointer to the clone/copy of the current node
10682  */
10683  FunctionBlock *clone() const override { return new FunctionBlock(*this); }
10684 
10685  /// \name Getters
10686  /// \{
10687 
10688  /**
10689  * \brief Return type (ast::AstNodeType) of ast node
10690  *
10691  * Every node in the ast has a type defined in ast::AstNodeType and this
10692  * function is used to retrieve the same.
10693  *
10694  * \return ast node type i.e. ast::AstNodeType::FUNCTION_BLOCK
10695  *
10696  * \sa Ast::get_node_type_name
10697  */
10698  AstNodeType get_node_type() const noexcept override {
10700  }
10701 
10702  /**
10703  * \brief Return type (ast::AstNodeType) of ast node as std::string
10704  *
10705  * Every node in the ast has a type defined in ast::AstNodeType.
10706  * This type name can be returned as a std::string for printing
10707  * node to text/json form.
10708  *
10709  * \return name of the node type as a string i.e. "FunctionBlock"
10710  *
10711  * \sa Ast::get_node_name
10712  */
10713  std::string get_node_type_name() const noexcept override {
10714  return "FunctionBlock";
10715  }
10716 
10717  /**
10718  * \brief Return NMODL statement of ast node as std::string
10719  *
10720  * Every node is related to a special statement in the NMODL. This
10721  * statement can be returned as a std::string for printing to
10722  * text/json form.
10723  *
10724  * \return name of the statement as a string i.e. "FUNCTION "
10725  *
10726  * \sa Ast::get_nmodl_name
10727  */
10728  std::string get_nmodl_name() const noexcept override { return "FUNCTION "; }
10729 
10730  /**
10731  * \brief Get std::shared_ptr from `this` pointer of the current ast node
10732  */
10733  std::shared_ptr<Ast> get_shared_ptr() override {
10734  return std::static_pointer_cast<FunctionBlock>(shared_from_this());
10735  }
10736 
10737  /**
10738  * \brief Get std::shared_ptr from `this` pointer of the current ast node
10739  */
10740  std::shared_ptr<const Ast> get_shared_ptr() const override {
10741  return std::static_pointer_cast<const FunctionBlock>(shared_from_this());
10742  }
10743 
10744  /**
10745  * \brief Return associated token for the current ast node
10746  *
10747  * Not all ast nodes have token information. For example,
10748  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
10749  * solution of ODEs. In this case, we return nullptr to store in the
10750  * nmodl::symtab::SymbolTable.
10751  *
10752  * \return pointer to token if exist otherwise nullptr
10753  */
10754  const ModToken *get_token() const noexcept override { return token.get(); }
10755 
10756  /**
10757  * \brief Return associated symbol table for the current ast node
10758  *
10759  * Only certain ast nodes (e.g. inherited from ast::Block) have associated
10760  * symbol table. These nodes have nmodl::symtab::SymbolTable as member
10761  * and it can be accessed using this method.
10762  *
10763  * \return pointer to the symbol table
10764  *
10765  * \sa nmodl::symtab::SymbolTable nmodl::visitor::SymtabVisitor
10766  */
10767  symtab::SymbolTable *get_symbol_table() const override { return symtab; }
10768 
10769  /**
10770  * \brief Return name of the node
10771  *
10772  * Some ast nodes have a member marked designated as node name. For example,
10773  * in case of this ast::Name has name designated as a
10774  * node name.
10775  *
10776  * @return name of the node as std::string
10777  *
10778  * \sa Ast::get_node_type_name
10779  */
10780  std::string get_node_name() const override;
10781 
10782  /**
10783  * \brief Getter for member variable \ref FunctionBlock.name
10784  */
10785  const std::shared_ptr<Name> &get_name() const noexcept { return name; }
10786 
10787  /**
10788  * \brief Getter for member variable \ref FunctionBlock.parameters
10789  */
10790  const ArgumentVector &get_parameters() const noexcept override {
10791  return parameters;
10792  }
10793 
10794  /**
10795  * \brief Getter for member variable \ref FunctionBlock.unit
10796  */
10797  const std::shared_ptr<Unit> &get_unit() const noexcept { return unit; }
10798 
10799  /**
10800  * \brief Getter for member variable \ref FunctionBlock.statement_block
10801  */
10802  const std::shared_ptr<StatementBlock> &get_statement_block() const
10803  noexcept override {
10804  return statement_block;
10805  }
10806 
10807  /// \}
10808 
10809  /// \name Setters
10810  /// \{
10811 
10812  /**
10813  * \brief Set token for the current ast node
10814  */
10815  void set_token(const ModToken &tok) {
10816  token = std::make_shared<ModToken>(tok);
10817  }
10818 
10819  /**
10820  * \brief Set symbol table for the current ast node
10821  *
10822  * Top level, block scoped nodes store symbol table in the ast node.
10823  * nmodl::visitor::SymtabVisitor then used this method to setup symbol table
10824  * for every node in the ast.
10825  *
10826  * \sa nmodl::visitor::SymtabVisitor
10827  */
10828  void set_symbol_table(symtab::SymbolTable *newsymtab) override {
10829  symtab = newsymtab;
10830  }
10831 
10832  /**
10833  * \brief Setter for member variable \ref FunctionBlock.name (rvalue
10834  * reference)
10835  */
10836  void set_name(std::shared_ptr<Name> &&name);
10837 
10838  /**
10839  * \brief Setter for member variable \ref FunctionBlock.name
10840  */
10841  void set_name(const std::shared_ptr<Name> &name);
10842 
10843  /**
10844  * \brief Setter for member variable \ref FunctionBlock.parameters (rvalue
10845  * reference)
10846  */
10847  void set_parameters(ArgumentVector &&parameters);
10848 
10849  /**
10850  * \brief Setter for member variable \ref FunctionBlock.parameters
10851  */
10852  void set_parameters(const ArgumentVector &parameters);
10853 
10854  /**
10855  * \brief Setter for member variable \ref FunctionBlock.unit (rvalue
10856  * reference)
10857  */
10858  void set_unit(std::shared_ptr<Unit> &&unit);
10859 
10860  /**
10861  * \brief Setter for member variable \ref FunctionBlock.unit
10862  */
10863  void set_unit(const std::shared_ptr<Unit> &unit);
10864 
10865  /**
10866  * \brief Setter for member variable \ref FunctionBlock.statement_block
10867  * (rvalue reference)
10868  */
10869  void set_statement_block(std::shared_ptr<StatementBlock> &&statement_block);
10870 
10871  /**
10872  * \brief Setter for member variable \ref FunctionBlock.statement_block
10873  */
10874  void
10875  set_statement_block(const std::shared_ptr<StatementBlock> &statement_block);
10876 
10877  /// \}
10878 
10879  /// \name Visitor
10880  /// \{
10881 
10882  /**
10883  * \brief visit children i.e. member variables of current node using provided
10884  * visitor
10885  *
10886  * Different nodes in the AST have different members (i.e. children). This
10887  * method recursively visits children using provided visitor.
10888  *
10889  * \param v Concrete visitor that will be used to recursively visit children
10890  *
10891  * \sa Ast::visit_children for example.
10892  */
10893  void visit_children(visitor::Visitor &v) override;
10894 
10895  /**
10896  * \brief visit children i.e. member variables of current node using provided
10897  * visitor
10898  *
10899  * Different nodes in the AST have different members (i.e. children). This
10900  * method recursively visits children using provided visitor.
10901  *
10902  * \param v Concrete constant visitor that will be used to recursively visit
10903  * children
10904  *
10905  * \sa Ast::visit_children for example.
10906  */
10907  void visit_children(visitor::ConstVisitor &v) const override;
10908 
10909  /**
10910  * \brief accept (or visit) the current AST node using provided visitor
10911  *
10912  * Instead of visiting children of AST node, like Ast::visit_children,
10913  * accept allows to visit the current node itself using provided concrete
10914  * visitor.
10915  *
10916  * \param v Concrete visitor that will be used to recursively visit node
10917  *
10918  * \sa Ast::accept for example.
10919  */
10920  void accept(visitor::Visitor &v) override;
10921 
10922  /**
10923  * \copydoc accept(visitor::Visitor&)
10924  */
10925  void accept(visitor::ConstVisitor &v) const override;
10926 
10927  /// \}
10928 
10929 private:
10930  /**
10931  * \brief Set this object as parent for all the children
10932  *
10933  * This should be called in every object (with children) constructor
10934  * to set parents. Since it is called only in the constructors it
10935  * should not be virtual to avoid ambiguities (issue #295).
10936  */
10937  void set_parent_in_children();
10938 };
10939 
10940 /** @} */ // end of ast_class
10941 
10942 } // namespace ast
10943 } // namespace nmodl
10944 #endif // !NMODL_AST_FUNCTION_BLOCK_HPP
10945 #ifndef NMODL_AST_PROCEDURE_BLOCK_HPP
10946 #define NMODL_AST_PROCEDURE_BLOCK_HPP
10947 
10948 namespace nmodl {
10949 namespace ast {
10950 
10951 /**
10952  * @addtogroup ast_class
10953  * @ingroup ast
10954  * @{
10955  */
10956 
10957 /**
10958  * \brief TODO
10959  *
10960  *
10961  */
10962 class ProcedureBlock : public Block {
10963 private:
10964  /// Name of the procedure
10965  std::shared_ptr<Name> name;
10966  /// Vector of the parameters
10968  /// Unit if specified
10969  std::shared_ptr<Unit> unit;
10970  /// Block with statements vector
10971  std::shared_ptr<StatementBlock> statement_block;
10972  /// token with location information
10973  std::shared_ptr<ModToken> token;
10974  /// symbol table for a block
10975  symtab::SymbolTable *symtab = nullptr;
10976 
10977 public:
10978  /// \name Ctor & dtor
10979  /// \{
10980 
10981  explicit ProcedureBlock(Name *name, ArgumentVector parameters, Unit *unit,
10982  StatementBlock *statement_block);
10983  explicit ProcedureBlock(
10984  const std::shared_ptr<Name> &name, const ArgumentVector &parameters,
10985  const std::shared_ptr<Unit> &unit,
10986  const std::shared_ptr<StatementBlock> &statement_block);
10987  ProcedureBlock(const ProcedureBlock &obj);
10988 
10989  virtual ~ProcedureBlock() = default;
10990 
10991  /// \}
10992 
10993  /**
10994  * \brief Check if the ast node is an instance of ast::ProcedureBlock
10995  * \return true as object is of type ast::ProcedureBlock
10996  */
10997  bool is_procedure_block() const noexcept override { return true; }
10998 
10999  /**
11000  * \brief Return a copy of the current node
11001  *
11002  * Recursively make a new copy/clone of the current node including
11003  * all members and return a pointer to the node. This is used for
11004  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
11005  * ast.
11006  *
11007  * @return pointer to the clone/copy of the current node
11008  */
11009  ProcedureBlock *clone() const override { return new ProcedureBlock(*this); }
11010 
11011  /// \name Getters
11012  /// \{
11013 
11014  /**
11015  * \brief Return type (ast::AstNodeType) of ast node
11016  *
11017  * Every node in the ast has a type defined in ast::AstNodeType and this
11018  * function is used to retrieve the same.
11019  *
11020  * \return ast node type i.e. ast::AstNodeType::PROCEDURE_BLOCK
11021  *
11022  * \sa Ast::get_node_type_name
11023  */
11024  AstNodeType get_node_type() const noexcept override {
11026  }
11027 
11028  /**
11029  * \brief Return type (ast::AstNodeType) of ast node as std::string
11030  *
11031  * Every node in the ast has a type defined in ast::AstNodeType.
11032  * This type name can be returned as a std::string for printing
11033  * node to text/json form.
11034  *
11035  * \return name of the node type as a string i.e. "ProcedureBlock"
11036  *
11037  * \sa Ast::get_node_name
11038  */
11039  std::string get_node_type_name() const noexcept override {
11040  return "ProcedureBlock";
11041  }
11042 
11043  /**
11044  * \brief Return NMODL statement of ast node as std::string
11045  *
11046  * Every node is related to a special statement in the NMODL. This
11047  * statement can be returned as a std::string for printing to
11048  * text/json form.
11049  *
11050  * \return name of the statement as a string i.e. "PROCEDURE "
11051  *
11052  * \sa Ast::get_nmodl_name
11053  */
11054  std::string get_nmodl_name() const noexcept override { return "PROCEDURE "; }
11055 
11056  /**
11057  * \brief Get std::shared_ptr from `this` pointer of the current ast node
11058  */
11059  std::shared_ptr<Ast> get_shared_ptr() override {
11060  return std::static_pointer_cast<ProcedureBlock>(shared_from_this());
11061  }
11062 
11063  /**
11064  * \brief Get std::shared_ptr from `this` pointer of the current ast node
11065  */
11066  std::shared_ptr<const Ast> get_shared_ptr() const override {
11067  return std::static_pointer_cast<const ProcedureBlock>(shared_from_this());
11068  }
11069 
11070  /**
11071  * \brief Return associated token for the current ast node
11072  *
11073  * Not all ast nodes have token information. For example,
11074  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
11075  * solution of ODEs. In this case, we return nullptr to store in the
11076  * nmodl::symtab::SymbolTable.
11077  *
11078  * \return pointer to token if exist otherwise nullptr
11079  */
11080  const ModToken *get_token() const noexcept override { return token.get(); }
11081 
11082  /**
11083  * \brief Return associated symbol table for the current ast node
11084  *
11085  * Only certain ast nodes (e.g. inherited from ast::Block) have associated
11086  * symbol table. These nodes have nmodl::symtab::SymbolTable as member
11087  * and it can be accessed using this method.
11088  *
11089  * \return pointer to the symbol table
11090  *
11091  * \sa nmodl::symtab::SymbolTable nmodl::visitor::SymtabVisitor
11092  */
11093  symtab::SymbolTable *get_symbol_table() const override { return symtab; }
11094 
11095  /**
11096  * \brief Return name of the node
11097  *
11098  * Some ast nodes have a member marked designated as node name. For example,
11099  * in case of this ast::Name has name designated as a
11100  * node name.
11101  *
11102  * @return name of the node as std::string
11103  *
11104  * \sa Ast::get_node_type_name
11105  */
11106  std::string get_node_name() const override;
11107 
11108  /**
11109  * \brief Getter for member variable \ref ProcedureBlock.name
11110  */
11111  const std::shared_ptr<Name> &get_name() const noexcept { return name; }
11112 
11113  /**
11114  * \brief Getter for member variable \ref ProcedureBlock.parameters
11115  */
11116  const ArgumentVector &get_parameters() const noexcept override {
11117  return parameters;
11118  }
11119 
11120  /**
11121  * \brief Getter for member variable \ref ProcedureBlock.unit
11122  */
11123  const std::shared_ptr<Unit> &get_unit() const noexcept { return unit; }
11124 
11125  /**
11126  * \brief Getter for member variable \ref ProcedureBlock.statement_block
11127  */
11128  const std::shared_ptr<StatementBlock> &get_statement_block() const
11129  noexcept override {
11130  return statement_block;
11131  }
11132 
11133  /// \}
11134 
11135  /// \name Setters
11136  /// \{
11137 
11138  /**
11139  * \brief Set token for the current ast node
11140  */
11141  void set_token(const ModToken &tok) {
11142  token = std::make_shared<ModToken>(tok);
11143  }
11144 
11145  /**
11146  * \brief Set symbol table for the current ast node
11147  *
11148  * Top level, block scoped nodes store symbol table in the ast node.
11149  * nmodl::visitor::SymtabVisitor then used this method to setup symbol table
11150  * for every node in the ast.
11151  *
11152  * \sa nmodl::visitor::SymtabVisitor
11153  */
11154  void set_symbol_table(symtab::SymbolTable *newsymtab) override {
11155  symtab = newsymtab;
11156  }
11157 
11158  /**
11159  * \brief Setter for member variable \ref ProcedureBlock.name (rvalue
11160  * reference)
11161  */
11162  void set_name(std::shared_ptr<Name> &&name);
11163 
11164  /**
11165  * \brief Setter for member variable \ref ProcedureBlock.name
11166  */
11167  void set_name(const std::shared_ptr<Name> &name);
11168 
11169  /**
11170  * \brief Setter for member variable \ref ProcedureBlock.parameters (rvalue
11171  * reference)
11172  */
11173  void set_parameters(ArgumentVector &&parameters);
11174 
11175  /**
11176  * \brief Setter for member variable \ref ProcedureBlock.parameters
11177  */
11178  void set_parameters(const ArgumentVector &parameters);
11179 
11180  /**
11181  * \brief Setter for member variable \ref ProcedureBlock.unit (rvalue
11182  * reference)
11183  */
11184  void set_unit(std::shared_ptr<Unit> &&unit);
11185 
11186  /**
11187  * \brief Setter for member variable \ref ProcedureBlock.unit
11188  */
11189  void set_unit(const std::shared_ptr<Unit> &unit);
11190 
11191  /**
11192  * \brief Setter for member variable \ref ProcedureBlock.statement_block
11193  * (rvalue reference)
11194  */
11195  void set_statement_block(std::shared_ptr<StatementBlock> &&statement_block);
11196 
11197  /**
11198  * \brief Setter for member variable \ref ProcedureBlock.statement_block
11199  */
11200  void
11201  set_statement_block(const std::shared_ptr<StatementBlock> &statement_block);
11202 
11203  /// \}
11204 
11205  /// \name Visitor
11206  /// \{
11207 
11208  /**
11209  * \brief visit children i.e. member variables of current node using provided
11210  * visitor
11211  *
11212  * Different nodes in the AST have different members (i.e. children). This
11213  * method recursively visits children using provided visitor.
11214  *
11215  * \param v Concrete visitor that will be used to recursively visit children
11216  *
11217  * \sa Ast::visit_children for example.
11218  */
11219  void visit_children(visitor::Visitor &v) override;
11220 
11221  /**
11222  * \brief visit children i.e. member variables of current node using provided
11223  * visitor
11224  *
11225  * Different nodes in the AST have different members (i.e. children). This
11226  * method recursively visits children using provided visitor.
11227  *
11228  * \param v Concrete constant visitor that will be used to recursively visit
11229  * children
11230  *
11231  * \sa Ast::visit_children for example.
11232  */
11233  void visit_children(visitor::ConstVisitor &v) const override;
11234 
11235  /**
11236  * \brief accept (or visit) the current AST node using provided visitor
11237  *
11238  * Instead of visiting children of AST node, like Ast::visit_children,
11239  * accept allows to visit the current node itself using provided concrete
11240  * visitor.
11241  *
11242  * \param v Concrete visitor that will be used to recursively visit node
11243  *
11244  * \sa Ast::accept for example.
11245  */
11246  void accept(visitor::Visitor &v) override;
11247 
11248  /**
11249  * \copydoc accept(visitor::Visitor&)
11250  */
11251  void accept(visitor::ConstVisitor &v) const override;
11252 
11253  /// \}
11254 
11255 private:
11256  /**
11257  * \brief Set this object as parent for all the children
11258  *
11259  * This should be called in every object (with children) constructor
11260  * to set parents. Since it is called only in the constructors it
11261  * should not be virtual to avoid ambiguities (issue #295).
11262  */
11263  void set_parent_in_children();
11264 };
11265 
11266 /** @} */ // end of ast_class
11267 
11268 } // namespace ast
11269 } // namespace nmodl
11270 #endif // !NMODL_AST_PROCEDURE_BLOCK_HPP
11271 #ifndef NMODL_AST_NET_RECEIVE_BLOCK_HPP
11272 #define NMODL_AST_NET_RECEIVE_BLOCK_HPP
11273 
11274 namespace nmodl {
11275 namespace ast {
11276 
11277 /**
11278  * @addtogroup ast_class
11279  * @ingroup ast
11280  * @{
11281  */
11282 
11283 /**
11284  * \brief TODO
11285  *
11286  *
11287  */
11288 class NetReceiveBlock : public Block {
11289 private:
11290  /// Parameters to the net receive block
11292  /// Block with statements vector
11293  std::shared_ptr<StatementBlock> statement_block;
11294  /// token with location information
11295  std::shared_ptr<ModToken> token;
11296  /// symbol table for a block
11297  symtab::SymbolTable *symtab = nullptr;
11298 
11299 public:
11300  /// \name Ctor & dtor
11301  /// \{
11302 
11303  explicit NetReceiveBlock(ArgumentVector parameters,
11304  StatementBlock *statement_block);
11305  explicit NetReceiveBlock(
11306  const ArgumentVector &parameters,
11307  const std::shared_ptr<StatementBlock> &statement_block);
11308  NetReceiveBlock(const NetReceiveBlock &obj);
11309 
11310  virtual ~NetReceiveBlock() = default;
11311 
11312  /// \}
11313 
11314  /**
11315  * \brief Check if the ast node is an instance of ast::NetReceiveBlock
11316  * \return true as object is of type ast::NetReceiveBlock
11317  */
11318  bool is_net_receive_block() const noexcept override { return true; }
11319 
11320  /**
11321  * \brief Return a copy of the current node
11322  *
11323  * Recursively make a new copy/clone of the current node including
11324  * all members and return a pointer to the node. This is used for
11325  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
11326  * ast.
11327  *
11328  * @return pointer to the clone/copy of the current node
11329  */
11330  NetReceiveBlock *clone() const override { return new NetReceiveBlock(*this); }
11331 
11332  /// \name Getters
11333  /// \{
11334 
11335  /**
11336  * \brief Return type (ast::AstNodeType) of ast node
11337  *
11338  * Every node in the ast has a type defined in ast::AstNodeType and this
11339  * function is used to retrieve the same.
11340  *
11341  * \return ast node type i.e. ast::AstNodeType::NET_RECEIVE_BLOCK
11342  *
11343  * \sa Ast::get_node_type_name
11344  */
11345  AstNodeType get_node_type() const noexcept override {
11347  }
11348 
11349  /**
11350  * \brief Return type (ast::AstNodeType) of ast node as std::string
11351  *
11352  * Every node in the ast has a type defined in ast::AstNodeType.
11353  * This type name can be returned as a std::string for printing
11354  * node to text/json form.
11355  *
11356  * \return name of the node type as a string i.e. "NetReceiveBlock"
11357  *
11358  * \sa Ast::get_node_name
11359  */
11360  std::string get_node_type_name() const noexcept override {
11361  return "NetReceiveBlock";
11362  }
11363 
11364  /**
11365  * \brief Return NMODL statement of ast node as std::string
11366  *
11367  * Every node is related to a special statement in the NMODL. This
11368  * statement can be returned as a std::string for printing to
11369  * text/json form.
11370  *
11371  * \return name of the statement as a string i.e. "NET_RECEIVE "
11372  *
11373  * \sa Ast::get_nmodl_name
11374  */
11375  std::string get_nmodl_name() const noexcept override {
11376  return "NET_RECEIVE ";
11377  }
11378 
11379  /**
11380  * \brief Get std::shared_ptr from `this` pointer of the current ast node
11381  */
11382  std::shared_ptr<Ast> get_shared_ptr() override {
11383  return std::static_pointer_cast<NetReceiveBlock>(shared_from_this());
11384  }
11385 
11386  /**
11387  * \brief Get std::shared_ptr from `this` pointer of the current ast node
11388  */
11389  std::shared_ptr<const Ast> get_shared_ptr() const override {
11390  return std::static_pointer_cast<const NetReceiveBlock>(shared_from_this());
11391  }
11392 
11393  /**
11394  * \brief Return associated token for the current ast node
11395  *
11396  * Not all ast nodes have token information. For example,
11397  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
11398  * solution of ODEs. In this case, we return nullptr to store in the
11399  * nmodl::symtab::SymbolTable.
11400  *
11401  * \return pointer to token if exist otherwise nullptr
11402  */
11403  const ModToken *get_token() const noexcept override { return token.get(); }
11404 
11405  /**
11406  * \brief Return associated symbol table for the current ast node
11407  *
11408  * Only certain ast nodes (e.g. inherited from ast::Block) have associated
11409  * symbol table. These nodes have nmodl::symtab::SymbolTable as member
11410  * and it can be accessed using this method.
11411  *
11412  * \return pointer to the symbol table
11413  *
11414  * \sa nmodl::symtab::SymbolTable nmodl::visitor::SymtabVisitor
11415  */
11416  symtab::SymbolTable *get_symbol_table() const override { return symtab; }
11417 
11418  /**
11419  * \brief Getter for member variable \ref NetReceiveBlock.parameters
11420  */
11421  const ArgumentVector &get_parameters() const noexcept override {
11422  return parameters;
11423  }
11424 
11425  /**
11426  * \brief Getter for member variable \ref NetReceiveBlock.statement_block
11427  */
11428  const std::shared_ptr<StatementBlock> &get_statement_block() const
11429  noexcept override {
11430  return statement_block;
11431  }
11432 
11433  /// \}
11434 
11435  /// \name Setters
11436  /// \{
11437 
11438  /**
11439  * \brief Set token for the current ast node
11440  */
11441  void set_token(const ModToken &tok) {
11442  token = std::make_shared<ModToken>(tok);
11443  }
11444 
11445  /**
11446  * \brief Set symbol table for the current ast node
11447  *
11448  * Top level, block scoped nodes store symbol table in the ast node.
11449  * nmodl::visitor::SymtabVisitor then used this method to setup symbol table
11450  * for every node in the ast.
11451  *
11452  * \sa nmodl::visitor::SymtabVisitor
11453  */
11454  void set_symbol_table(symtab::SymbolTable *newsymtab) override {
11455  symtab = newsymtab;
11456  }
11457 
11458  /**
11459  * \brief Setter for member variable \ref NetReceiveBlock.parameters (rvalue
11460  * reference)
11461  */
11462  void set_parameters(ArgumentVector &&parameters);
11463 
11464  /**
11465  * \brief Setter for member variable \ref NetReceiveBlock.parameters
11466  */
11467  void set_parameters(const ArgumentVector &parameters);
11468 
11469  /**
11470  * \brief Setter for member variable \ref NetReceiveBlock.statement_block
11471  * (rvalue reference)
11472  */
11473  void set_statement_block(std::shared_ptr<StatementBlock> &&statement_block);
11474 
11475  /**
11476  * \brief Setter for member variable \ref NetReceiveBlock.statement_block
11477  */
11478  void
11479  set_statement_block(const std::shared_ptr<StatementBlock> &statement_block);
11480 
11481  /// \}
11482 
11483  /// \name Visitor
11484  /// \{
11485 
11486  /**
11487  * \brief visit children i.e. member variables of current node using provided
11488  * visitor
11489  *
11490  * Different nodes in the AST have different members (i.e. children). This
11491  * method recursively visits children using provided visitor.
11492  *
11493  * \param v Concrete visitor that will be used to recursively visit children
11494  *
11495  * \sa Ast::visit_children for example.
11496  */
11497  void visit_children(visitor::Visitor &v) override;
11498 
11499  /**
11500  * \brief visit children i.e. member variables of current node using provided
11501  * visitor
11502  *
11503  * Different nodes in the AST have different members (i.e. children). This
11504  * method recursively visits children using provided visitor.
11505  *
11506  * \param v Concrete constant visitor that will be used to recursively visit
11507  * children
11508  *
11509  * \sa Ast::visit_children for example.
11510  */
11511  void visit_children(visitor::ConstVisitor &v) const override;
11512 
11513  /**
11514  * \brief accept (or visit) the current AST node using provided visitor
11515  *
11516  * Instead of visiting children of AST node, like Ast::visit_children,
11517  * accept allows to visit the current node itself using provided concrete
11518  * visitor.
11519  *
11520  * \param v Concrete visitor that will be used to recursively visit node
11521  *
11522  * \sa Ast::accept for example.
11523  */
11524  void accept(visitor::Visitor &v) override;
11525 
11526  /**
11527  * \copydoc accept(visitor::Visitor&)
11528  */
11529  void accept(visitor::ConstVisitor &v) const override;
11530 
11531  /// \}
11532 
11533 private:
11534  /**
11535  * \brief Set this object as parent for all the children
11536  *
11537  * This should be called in every object (with children) constructor
11538  * to set parents. Since it is called only in the constructors it
11539  * should not be virtual to avoid ambiguities (issue #295).
11540  */
11541  void set_parent_in_children();
11542 };
11543 
11544 /** @} */ // end of ast_class
11545 
11546 } // namespace ast
11547 } // namespace nmodl
11548 #endif // !NMODL_AST_NET_RECEIVE_BLOCK_HPP
11549 #ifndef NMODL_AST_SOLVE_BLOCK_HPP
11550 #define NMODL_AST_SOLVE_BLOCK_HPP
11551 
11552 namespace nmodl {
11553 namespace ast {
11554 
11555 /**
11556  * @addtogroup ast_class
11557  * @ingroup ast
11558  * @{
11559  */
11560 
11561 /**
11562  * \brief TODO
11563  *
11564  *
11565  */
11566 class SolveBlock : public Block {
11567 private:
11568  /// Name of the block to solve
11569  std::shared_ptr<Name> block_name;
11570  /// Name of the integration method
11571  std::shared_ptr<Name> method;
11572  /// Name of the integration method
11573  std::shared_ptr<Name> steadystate;
11574  /// Block to be executed on error
11575  std::shared_ptr<StatementBlock> ifsolerr;
11576  /// token with location information
11577  std::shared_ptr<ModToken> token;
11578  /// symbol table for a block
11579  symtab::SymbolTable *symtab = nullptr;
11580 
11581 public:
11582  /// \name Ctor & dtor
11583  /// \{
11584 
11585  explicit SolveBlock(Name *block_name, Name *method, Name *steadystate,
11586  StatementBlock *ifsolerr);
11587  explicit SolveBlock(const std::shared_ptr<Name> &block_name,
11588  const std::shared_ptr<Name> &method,
11589  const std::shared_ptr<Name> &steadystate,
11590  const std::shared_ptr<StatementBlock> &ifsolerr);
11591  SolveBlock(const SolveBlock &obj);
11592 
11593  virtual ~SolveBlock() = default;
11594 
11595  /// \}
11596 
11597  /**
11598  * \brief Check if the ast node is an instance of ast::SolveBlock
11599  * \return true as object is of type ast::SolveBlock
11600  */
11601  bool is_solve_block() const noexcept override { return true; }
11602 
11603  /**
11604  * \brief Return a copy of the current node
11605  *
11606  * Recursively make a new copy/clone of the current node including
11607  * all members and return a pointer to the node. This is used for
11608  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
11609  * ast.
11610  *
11611  * @return pointer to the clone/copy of the current node
11612  */
11613  SolveBlock *clone() const override { return new SolveBlock(*this); }
11614 
11615  /// \name Getters
11616  /// \{
11617 
11618  /**
11619  * \brief Return type (ast::AstNodeType) of ast node
11620  *
11621  * Every node in the ast has a type defined in ast::AstNodeType and this
11622  * function is used to retrieve the same.
11623  *
11624  * \return ast node type i.e. ast::AstNodeType::SOLVE_BLOCK
11625  *
11626  * \sa Ast::get_node_type_name
11627  */
11628  AstNodeType get_node_type() const noexcept override {
11629  return AstNodeType::SOLVE_BLOCK;
11630  }
11631 
11632  /**
11633  * \brief Return type (ast::AstNodeType) of ast node as std::string
11634  *
11635  * Every node in the ast has a type defined in ast::AstNodeType.
11636  * This type name can be returned as a std::string for printing
11637  * node to text/json form.
11638  *
11639  * \return name of the node type as a string i.e. "SolveBlock"
11640  *
11641  * \sa Ast::get_node_name
11642  */
11643  std::string get_node_type_name() const noexcept override {
11644  return "SolveBlock";
11645  }
11646 
11647  /**
11648  * \brief Return NMODL statement of ast node as std::string
11649  *
11650  * Every node is related to a special statement in the NMODL. This
11651  * statement can be returned as a std::string for printing to
11652  * text/json form.
11653  *
11654  * \return name of the statement as a string i.e. "SOLVE"
11655  *
11656  * \sa Ast::get_nmodl_name
11657  */
11658  std::string get_nmodl_name() const noexcept override { return "SOLVE"; }
11659 
11660  /**
11661  * \brief Get std::shared_ptr from `this` pointer of the current ast node
11662  */
11663  std::shared_ptr<Ast> get_shared_ptr() override {
11664  return std::static_pointer_cast<SolveBlock>(shared_from_this());
11665  }
11666 
11667  /**
11668  * \brief Get std::shared_ptr from `this` pointer of the current ast node
11669  */
11670  std::shared_ptr<const Ast> get_shared_ptr() const override {
11671  return std::static_pointer_cast<const SolveBlock>(shared_from_this());
11672  }
11673 
11674  /**
11675  * \brief Return associated token for the current ast node
11676  *
11677  * Not all ast nodes have token information. For example,
11678  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
11679  * solution of ODEs. In this case, we return nullptr to store in the
11680  * nmodl::symtab::SymbolTable.
11681  *
11682  * \return pointer to token if exist otherwise nullptr
11683  */
11684  const ModToken *get_token() const noexcept override { return token.get(); }
11685 
11686  /**
11687  * \brief Return associated symbol table for the current ast node
11688  *
11689  * Only certain ast nodes (e.g. inherited from ast::Block) have associated
11690  * symbol table. These nodes have nmodl::symtab::SymbolTable as member
11691  * and it can be accessed using this method.
11692  *
11693  * \return pointer to the symbol table
11694  *
11695  * \sa nmodl::symtab::SymbolTable nmodl::visitor::SymtabVisitor
11696  */
11697  symtab::SymbolTable *get_symbol_table() const override { return symtab; }
11698 
11699  /**
11700  * \brief Getter for member variable \ref SolveBlock.block_name
11701  */
11702  const std::shared_ptr<Name> &get_block_name() const noexcept {
11703  return block_name;
11704  }
11705 
11706  /**
11707  * \brief Getter for member variable \ref SolveBlock.method
11708  */
11709  const std::shared_ptr<Name> &get_method() const noexcept { return method; }
11710 
11711  /**
11712  * \brief Getter for member variable \ref SolveBlock.steadystate
11713  */
11714  const std::shared_ptr<Name> &get_steadystate() const noexcept {
11715  return steadystate;
11716  }
11717 
11718  /**
11719  * \brief Getter for member variable \ref SolveBlock.ifsolerr
11720  */
11721  const std::shared_ptr<StatementBlock> &get_ifsolerr() const noexcept {
11722  return ifsolerr;
11723  }
11724 
11725  /// \}
11726 
11727  /// \name Setters
11728  /// \{
11729 
11730  /**
11731  * \brief Set token for the current ast node
11732  */
11733  void set_token(const ModToken &tok) {
11734  token = std::make_shared<ModToken>(tok);
11735  }
11736 
11737  /**
11738  * \brief Set symbol table for the current ast node
11739  *
11740  * Top level, block scoped nodes store symbol table in the ast node.
11741  * nmodl::visitor::SymtabVisitor then used this method to setup symbol table
11742  * for every node in the ast.
11743  *
11744  * \sa nmodl::visitor::SymtabVisitor
11745  */
11746  void set_symbol_table(symtab::SymbolTable *newsymtab) override {
11747  symtab = newsymtab;
11748  }
11749 
11750  /**
11751  * \brief Setter for member variable \ref SolveBlock.block_name (rvalue
11752  * reference)
11753  */
11754  void set_block_name(std::shared_ptr<Name> &&block_name);
11755 
11756  /**
11757  * \brief Setter for member variable \ref SolveBlock.block_name
11758  */
11759  void set_block_name(const std::shared_ptr<Name> &block_name);
11760 
11761  /**
11762  * \brief Setter for member variable \ref SolveBlock.method (rvalue reference)
11763  */
11764  void set_method(std::shared_ptr<Name> &&method);
11765 
11766  /**
11767  * \brief Setter for member variable \ref SolveBlock.method
11768  */
11769  void set_method(const std::shared_ptr<Name> &method);
11770 
11771  /**
11772  * \brief Setter for member variable \ref SolveBlock.steadystate (rvalue
11773  * reference)
11774  */
11775  void set_steadystate(std::shared_ptr<Name> &&steadystate);
11776 
11777  /**
11778  * \brief Setter for member variable \ref SolveBlock.steadystate
11779  */
11780  void set_steadystate(const std::shared_ptr<Name> &steadystate);
11781 
11782  /**
11783  * \brief Setter for member variable \ref SolveBlock.ifsolerr (rvalue
11784  * reference)
11785  */
11786  void set_ifsolerr(std::shared_ptr<StatementBlock> &&ifsolerr);
11787 
11788  /**
11789  * \brief Setter for member variable \ref SolveBlock.ifsolerr
11790  */
11791  void set_ifsolerr(const std::shared_ptr<StatementBlock> &ifsolerr);
11792 
11793  /// \}
11794 
11795  /// \name Visitor
11796  /// \{
11797 
11798  /**
11799  * \brief visit children i.e. member variables of current node using provided
11800  * visitor
11801  *
11802  * Different nodes in the AST have different members (i.e. children). This
11803  * method recursively visits children using provided visitor.
11804  *
11805  * \param v Concrete visitor that will be used to recursively visit children
11806  *
11807  * \sa Ast::visit_children for example.
11808  */
11809  void visit_children(visitor::Visitor &v) override;
11810 
11811  /**
11812  * \brief visit children i.e. member variables of current node using provided
11813  * visitor
11814  *
11815  * Different nodes in the AST have different members (i.e. children). This
11816  * method recursively visits children using provided visitor.
11817  *
11818  * \param v Concrete constant visitor that will be used to recursively visit
11819  * children
11820  *
11821  * \sa Ast::visit_children for example.
11822  */
11823  void visit_children(visitor::ConstVisitor &v) const override;
11824 
11825  /**
11826  * \brief accept (or visit) the current AST node using provided visitor
11827  *
11828  * Instead of visiting children of AST node, like Ast::visit_children,
11829  * accept allows to visit the current node itself using provided concrete
11830  * visitor.
11831  *
11832  * \param v Concrete visitor that will be used to recursively visit node
11833  *
11834  * \sa Ast::accept for example.
11835  */
11836  void accept(visitor::Visitor &v) override;
11837 
11838  /**
11839  * \copydoc accept(visitor::Visitor&)
11840  */
11841  void accept(visitor::ConstVisitor &v) const override;
11842 
11843  /// \}
11844 
11845 private:
11846  /**
11847  * \brief Set this object as parent for all the children
11848  *
11849  * This should be called in every object (with children) constructor
11850  * to set parents. Since it is called only in the constructors it
11851  * should not be virtual to avoid ambiguities (issue #295).
11852  */
11853  void set_parent_in_children();
11854 };
11855 
11856 /** @} */ // end of ast_class
11857 
11858 } // namespace ast
11859 } // namespace nmodl
11860 #endif // !NMODL_AST_SOLVE_BLOCK_HPP
11861 #ifndef NMODL_AST_BREAKPOINT_BLOCK_HPP
11862 #define NMODL_AST_BREAKPOINT_BLOCK_HPP
11863 
11864 namespace nmodl {
11865 namespace ast {
11866 
11867 /**
11868  * @addtogroup ast_class
11869  * @ingroup ast
11870  * @{
11871  */
11872 
11873 /**
11874  * \brief Represents a `BREAKPOINT` block in NMODL
11875  *
11876  * The `BREAKPOINT` block is used to update current and conductance.
11877  * at each time step. Here is an example of `BEFORE` :
11878  *
11879  * \code{.mod}
11880  * BREAKPOINT {
11881  * SOLVE states METHOD cnexp
11882  * gna = gnabar*m*m*m*h
11883  * ina = gna*(v - ena)
11884  * gk = gkbar*n*n*n*n
11885  * ik = gk*(v - ek)
11886  * il = gl*(v - el)
11887  * }
11888  * \endcode
11889  *
11890  * \sa ast::DerivativeBlock ast::InitialBlock
11891  *
11892  */
11893 class BreakpointBlock : public Block {
11894 private:
11895  /// Block with statements vector
11896  std::shared_ptr<StatementBlock> statement_block;
11897  /// token with location information
11898  std::shared_ptr<ModToken> token;
11899  /// symbol table for a block
11900  symtab::SymbolTable *symtab = nullptr;
11901 
11902 public:
11903  /// \name Ctor & dtor
11904  /// \{
11905 
11906  explicit BreakpointBlock(StatementBlock *statement_block);
11907  explicit BreakpointBlock(
11908  const std::shared_ptr<StatementBlock> &statement_block);
11909  BreakpointBlock(const BreakpointBlock &obj);
11910 
11911  virtual ~BreakpointBlock() = default;
11912 
11913  /// \}
11914 
11915  /**
11916  * \brief Check if the ast node is an instance of ast::BreakpointBlock
11917  * \return true as object is of type ast::BreakpointBlock
11918  */
11919  bool is_breakpoint_block() const noexcept override { return true; }
11920 
11921  /**
11922  * \brief Return a copy of the current node
11923  *
11924  * Recursively make a new copy/clone of the current node including
11925  * all members and return a pointer to the node. This is used for
11926  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
11927  * ast.
11928  *
11929  * @return pointer to the clone/copy of the current node
11930  */
11931  BreakpointBlock *clone() const override { return new BreakpointBlock(*this); }
11932 
11933  /// \name Getters
11934  /// \{
11935 
11936  /**
11937  * \brief Return type (ast::AstNodeType) of ast node
11938  *
11939  * Every node in the ast has a type defined in ast::AstNodeType and this
11940  * function is used to retrieve the same.
11941  *
11942  * \return ast node type i.e. ast::AstNodeType::BREAKPOINT_BLOCK
11943  *
11944  * \sa Ast::get_node_type_name
11945  */
11946  AstNodeType get_node_type() const noexcept override {
11948  }
11949 
11950  /**
11951  * \brief Return type (ast::AstNodeType) of ast node as std::string
11952  *
11953  * Every node in the ast has a type defined in ast::AstNodeType.
11954  * This type name can be returned as a std::string for printing
11955  * node to text/json form.
11956  *
11957  * \return name of the node type as a string i.e. "BreakpointBlock"
11958  *
11959  * \sa Ast::get_node_name
11960  */
11961  std::string get_node_type_name() const noexcept override {
11962  return "BreakpointBlock";
11963  }
11964 
11965  /**
11966  * \brief Return NMODL statement of ast node as std::string
11967  *
11968  * Every node is related to a special statement in the NMODL. This
11969  * statement can be returned as a std::string for printing to
11970  * text/json form.
11971  *
11972  * \return name of the statement as a string i.e. "BREAKPOINT "
11973  *
11974  * \sa Ast::get_nmodl_name
11975  */
11976  std::string get_nmodl_name() const noexcept override { return "BREAKPOINT "; }
11977 
11978  /**
11979  * \brief Get std::shared_ptr from `this` pointer of the current ast node
11980  */
11981  std::shared_ptr<Ast> get_shared_ptr() override {
11982  return std::static_pointer_cast<BreakpointBlock>(shared_from_this());
11983  }
11984 
11985  /**
11986  * \brief Get std::shared_ptr from `this` pointer of the current ast node
11987  */
11988  std::shared_ptr<const Ast> get_shared_ptr() const override {
11989  return std::static_pointer_cast<const BreakpointBlock>(shared_from_this());
11990  }
11991 
11992  /**
11993  * \brief Return associated token for the current ast node
11994  *
11995  * Not all ast nodes have token information. For example,
11996  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
11997  * solution of ODEs. In this case, we return nullptr to store in the
11998  * nmodl::symtab::SymbolTable.
11999  *
12000  * \return pointer to token if exist otherwise nullptr
12001  */
12002  const ModToken *get_token() const noexcept override { return token.get(); }
12003 
12004  /**
12005  * \brief Return associated symbol table for the current ast node
12006  *
12007  * Only certain ast nodes (e.g. inherited from ast::Block) have associated
12008  * symbol table. These nodes have nmodl::symtab::SymbolTable as member
12009  * and it can be accessed using this method.
12010  *
12011  * \return pointer to the symbol table
12012  *
12013  * \sa nmodl::symtab::SymbolTable nmodl::visitor::SymtabVisitor
12014  */
12015  symtab::SymbolTable *get_symbol_table() const override { return symtab; }
12016 
12017  /**
12018  * \brief Getter for member variable \ref BreakpointBlock.statement_block
12019  */
12020  const std::shared_ptr<StatementBlock> &get_statement_block() const
12021  noexcept override {
12022  return statement_block;
12023  }
12024 
12025  /// \}
12026 
12027  /// \name Setters
12028  /// \{
12029 
12030  /**
12031  * \brief Set token for the current ast node
12032  */
12033  void set_token(const ModToken &tok) {
12034  token = std::make_shared<ModToken>(tok);
12035  }
12036 
12037  /**
12038  * \brief Set symbol table for the current ast node
12039  *
12040  * Top level, block scoped nodes store symbol table in the ast node.
12041  * nmodl::visitor::SymtabVisitor then used this method to setup symbol table
12042  * for every node in the ast.
12043  *
12044  * \sa nmodl::visitor::SymtabVisitor
12045  */
12046  void set_symbol_table(symtab::SymbolTable *newsymtab) override {
12047  symtab = newsymtab;
12048  }
12049 
12050  /**
12051  * \brief Setter for member variable \ref BreakpointBlock.statement_block
12052  * (rvalue reference)
12053  */
12054  void set_statement_block(std::shared_ptr<StatementBlock> &&statement_block);
12055 
12056  /**
12057  * \brief Setter for member variable \ref BreakpointBlock.statement_block
12058  */
12059  void
12060  set_statement_block(const std::shared_ptr<StatementBlock> &statement_block);
12061 
12062  /// \}
12063 
12064  /// \name Visitor
12065  /// \{
12066 
12067  /**
12068  * \brief visit children i.e. member variables of current node using provided
12069  * visitor
12070  *
12071  * Different nodes in the AST have different members (i.e. children). This
12072  * method recursively visits children using provided visitor.
12073  *
12074  * \param v Concrete visitor that will be used to recursively visit children
12075  *
12076  * \sa Ast::visit_children for example.
12077  */
12078  void visit_children(visitor::Visitor &v) override;
12079 
12080  /**
12081  * \brief visit children i.e. member variables of current node using provided
12082  * visitor
12083  *
12084  * Different nodes in the AST have different members (i.e. children). This
12085  * method recursively visits children using provided visitor.
12086  *
12087  * \param v Concrete constant visitor that will be used to recursively visit
12088  * children
12089  *
12090  * \sa Ast::visit_children for example.
12091  */
12092  void visit_children(visitor::ConstVisitor &v) const override;
12093 
12094  /**
12095  * \brief accept (or visit) the current AST node using provided visitor
12096  *
12097  * Instead of visiting children of AST node, like Ast::visit_children,
12098  * accept allows to visit the current node itself using provided concrete
12099  * visitor.
12100  *
12101  * \param v Concrete visitor that will be used to recursively visit node
12102  *
12103  * \sa Ast::accept for example.
12104  */
12105  void accept(visitor::Visitor &v) override;
12106 
12107  /**
12108  * \copydoc accept(visitor::Visitor&)
12109  */
12110  void accept(visitor::ConstVisitor &v) const override;
12111 
12112  /// \}
12113 
12114 private:
12115  /**
12116  * \brief Set this object as parent for all the children
12117  *
12118  * This should be called in every object (with children) constructor
12119  * to set parents. Since it is called only in the constructors it
12120  * should not be virtual to avoid ambiguities (issue #295).
12121  */
12122  void set_parent_in_children();
12123 };
12124 
12125 /** @} */ // end of ast_class
12126 
12127 } // namespace ast
12128 } // namespace nmodl
12129 #endif // !NMODL_AST_BREAKPOINT_BLOCK_HPP
12130 #ifndef NMODL_AST_TERMINAL_BLOCK_HPP
12131 #define NMODL_AST_TERMINAL_BLOCK_HPP
12132 
12133 namespace nmodl {
12134 namespace ast {
12135 
12136 /**
12137  * @addtogroup ast_class
12138  * @ingroup ast
12139  * @{
12140  */
12141 
12142 /**
12143  * \brief TODO
12144  *
12145  *
12146  */
12147 class TerminalBlock : public Block {
12148 private:
12149  /// Block with statements vector
12150  std::shared_ptr<StatementBlock> statement_block;
12151  /// token with location information
12152  std::shared_ptr<ModToken> token;
12153  /// symbol table for a block
12154  symtab::SymbolTable *symtab = nullptr;
12155 
12156 public:
12157  /// \name Ctor & dtor
12158  /// \{
12159 
12160  explicit TerminalBlock(StatementBlock *statement_block);
12161  explicit TerminalBlock(
12162  const std::shared_ptr<StatementBlock> &statement_block);
12163  TerminalBlock(const TerminalBlock &obj);
12164 
12165  virtual ~TerminalBlock() = default;
12166 
12167  /// \}
12168 
12169  /**
12170  * \brief Check if the ast node is an instance of ast::TerminalBlock
12171  * \return true as object is of type ast::TerminalBlock
12172  */
12173  bool is_terminal_block() const noexcept override { return true; }
12174 
12175  /**
12176  * \brief Return a copy of the current node
12177  *
12178  * Recursively make a new copy/clone of the current node including
12179  * all members and return a pointer to the node. This is used for
12180  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
12181  * ast.
12182  *
12183  * @return pointer to the clone/copy of the current node
12184  */
12185  TerminalBlock *clone() const override { return new TerminalBlock(*this); }
12186 
12187  /// \name Getters
12188  /// \{
12189 
12190  /**
12191  * \brief Return type (ast::AstNodeType) of ast node
12192  *
12193  * Every node in the ast has a type defined in ast::AstNodeType and this
12194  * function is used to retrieve the same.
12195  *
12196  * \return ast node type i.e. ast::AstNodeType::TERMINAL_BLOCK
12197  *
12198  * \sa Ast::get_node_type_name
12199  */
12200  AstNodeType get_node_type() const noexcept override {
12202  }
12203 
12204  /**
12205  * \brief Return type (ast::AstNodeType) of ast node as std::string
12206  *
12207  * Every node in the ast has a type defined in ast::AstNodeType.
12208  * This type name can be returned as a std::string for printing
12209  * node to text/json form.
12210  *
12211  * \return name of the node type as a string i.e. "TerminalBlock"
12212  *
12213  * \sa Ast::get_node_name
12214  */
12215  std::string get_node_type_name() const noexcept override {
12216  return "TerminalBlock";
12217  }
12218 
12219  /**
12220  * \brief Return NMODL statement of ast node as std::string
12221  *
12222  * Every node is related to a special statement in the NMODL. This
12223  * statement can be returned as a std::string for printing to
12224  * text/json form.
12225  *
12226  * \return name of the statement as a string i.e. "TERMINAL "
12227  *
12228  * \sa Ast::get_nmodl_name
12229  */
12230  std::string get_nmodl_name() const noexcept override { return "TERMINAL "; }
12231 
12232  /**
12233  * \brief Get std::shared_ptr from `this` pointer of the current ast node
12234  */
12235  std::shared_ptr<Ast> get_shared_ptr() override {
12236  return std::static_pointer_cast<TerminalBlock>(shared_from_this());
12237  }
12238 
12239  /**
12240  * \brief Get std::shared_ptr from `this` pointer of the current ast node
12241  */
12242  std::shared_ptr<const Ast> get_shared_ptr() const override {
12243  return std::static_pointer_cast<const TerminalBlock>(shared_from_this());
12244  }
12245 
12246  /**
12247  * \brief Return associated token for the current ast node
12248  *
12249  * Not all ast nodes have token information. For example,
12250  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
12251  * solution of ODEs. In this case, we return nullptr to store in the
12252  * nmodl::symtab::SymbolTable.
12253  *
12254  * \return pointer to token if exist otherwise nullptr
12255  */
12256  const ModToken *get_token() const noexcept override { return token.get(); }
12257 
12258  /**
12259  * \brief Return associated symbol table for the current ast node
12260  *
12261  * Only certain ast nodes (e.g. inherited from ast::Block) have associated
12262  * symbol table. These nodes have nmodl::symtab::SymbolTable as member
12263  * and it can be accessed using this method.
12264  *
12265  * \return pointer to the symbol table
12266  *
12267  * \sa nmodl::symtab::SymbolTable nmodl::visitor::SymtabVisitor
12268  */
12269  symtab::SymbolTable *get_symbol_table() const override { return symtab; }
12270 
12271  /**
12272  * \brief Getter for member variable \ref TerminalBlock.statement_block
12273  */
12274  const std::shared_ptr<StatementBlock> &get_statement_block() const
12275  noexcept override {
12276  return statement_block;
12277  }
12278 
12279  /// \}
12280 
12281  /// \name Setters
12282  /// \{
12283 
12284  /**
12285  * \brief Set token for the current ast node
12286  */
12287  void set_token(const ModToken &tok) {
12288  token = std::make_shared<ModToken>(tok);
12289  }
12290 
12291  /**
12292  * \brief Set symbol table for the current ast node
12293  *
12294  * Top level, block scoped nodes store symbol table in the ast node.
12295  * nmodl::visitor::SymtabVisitor then used this method to setup symbol table
12296  * for every node in the ast.
12297  *
12298  * \sa nmodl::visitor::SymtabVisitor
12299  */
12300  void set_symbol_table(symtab::SymbolTable *newsymtab) override {
12301  symtab = newsymtab;
12302  }
12303 
12304  /**
12305  * \brief Setter for member variable \ref TerminalBlock.statement_block
12306  * (rvalue reference)
12307  */
12308  void set_statement_block(std::shared_ptr<StatementBlock> &&statement_block);
12309 
12310  /**
12311  * \brief Setter for member variable \ref TerminalBlock.statement_block
12312  */
12313  void
12314  set_statement_block(const std::shared_ptr<StatementBlock> &statement_block);
12315 
12316  /// \}
12317 
12318  /// \name Visitor
12319  /// \{
12320 
12321  /**
12322  * \brief visit children i.e. member variables of current node using provided
12323  * visitor
12324  *
12325  * Different nodes in the AST have different members (i.e. children). This
12326  * method recursively visits children using provided visitor.
12327  *
12328  * \param v Concrete visitor that will be used to recursively visit children
12329  *
12330  * \sa Ast::visit_children for example.
12331  */
12332  void visit_children(visitor::Visitor &v) override;
12333 
12334  /**
12335  * \brief visit children i.e. member variables of current node using provided
12336  * visitor
12337  *
12338  * Different nodes in the AST have different members (i.e. children). This
12339  * method recursively visits children using provided visitor.
12340  *
12341  * \param v Concrete constant visitor that will be used to recursively visit
12342  * children
12343  *
12344  * \sa Ast::visit_children for example.
12345  */
12346  void visit_children(visitor::ConstVisitor &v) const override;
12347 
12348  /**
12349  * \brief accept (or visit) the current AST node using provided visitor
12350  *
12351  * Instead of visiting children of AST node, like Ast::visit_children,
12352  * accept allows to visit the current node itself using provided concrete
12353  * visitor.
12354  *
12355  * \param v Concrete visitor that will be used to recursively visit node
12356  *
12357  * \sa Ast::accept for example.
12358  */
12359  void accept(visitor::Visitor &v) override;
12360 
12361  /**
12362  * \copydoc accept(visitor::Visitor&)
12363  */
12364  void accept(visitor::ConstVisitor &v) const override;
12365 
12366  /// \}
12367 
12368 private:
12369  /**
12370  * \brief Set this object as parent for all the children
12371  *
12372  * This should be called in every object (with children) constructor
12373  * to set parents. Since it is called only in the constructors it
12374  * should not be virtual to avoid ambiguities (issue #295).
12375  */
12376  void set_parent_in_children();
12377 };
12378 
12379 /** @} */ // end of ast_class
12380 
12381 } // namespace ast
12382 } // namespace nmodl
12383 #endif // !NMODL_AST_TERMINAL_BLOCK_HPP
12384 #ifndef NMODL_AST_BEFORE_BLOCK_HPP
12385 #define NMODL_AST_BEFORE_BLOCK_HPP
12386 
12387 namespace nmodl {
12388 namespace ast {
12389 
12390 /**
12391  * @addtogroup ast_class
12392  * @ingroup ast
12393  * @{
12394  */
12395 
12396 /**
12397  * \brief Represents a `BEFORE` block in NMODL
12398  *
12399  *
12400  */
12401 class BeforeBlock : public Block {
12402 private:
12403  /// Block to be called before
12404  std::shared_ptr<BABlock> bablock;
12405  /// token with location information
12406  std::shared_ptr<ModToken> token;
12407  /// symbol table for a block
12408  symtab::SymbolTable *symtab = nullptr;
12409 
12410 public:
12411  /// \name Ctor & dtor
12412  /// \{
12413 
12414  explicit BeforeBlock(BABlock *bablock);
12415  explicit BeforeBlock(const std::shared_ptr<BABlock> &bablock);
12416  BeforeBlock(const BeforeBlock &obj);
12417 
12418  virtual ~BeforeBlock() = default;
12419 
12420  /// \}
12421 
12422  /**
12423  * \brief Check if the ast node is an instance of ast::BeforeBlock
12424  * \return true as object is of type ast::BeforeBlock
12425  */
12426  bool is_before_block() const noexcept override { return true; }
12427 
12428  /**
12429  * \brief Return a copy of the current node
12430  *
12431  * Recursively make a new copy/clone of the current node including
12432  * all members and return a pointer to the node. This is used for
12433  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
12434  * ast.
12435  *
12436  * @return pointer to the clone/copy of the current node
12437  */
12438  BeforeBlock *clone() const override { return new BeforeBlock(*this); }
12439 
12440  /// \name Getters
12441  /// \{
12442 
12443  /**
12444  * \brief Return type (ast::AstNodeType) of ast node
12445  *
12446  * Every node in the ast has a type defined in ast::AstNodeType and this
12447  * function is used to retrieve the same.
12448  *
12449  * \return ast node type i.e. ast::AstNodeType::BEFORE_BLOCK
12450  *
12451  * \sa Ast::get_node_type_name
12452  */
12453  AstNodeType get_node_type() const noexcept override {
12455  }
12456 
12457  /**
12458  * \brief Return type (ast::AstNodeType) of ast node as std::string
12459  *
12460  * Every node in the ast has a type defined in ast::AstNodeType.
12461  * This type name can be returned as a std::string for printing
12462  * node to text/json form.
12463  *
12464  * \return name of the node type as a string i.e. "BeforeBlock"
12465  *
12466  * \sa Ast::get_node_name
12467  */
12468  std::string get_node_type_name() const noexcept override {
12469  return "BeforeBlock";
12470  }
12471 
12472  /**
12473  * \brief Return NMODL statement of ast node as std::string
12474  *
12475  * Every node is related to a special statement in the NMODL. This
12476  * statement can be returned as a std::string for printing to
12477  * text/json form.
12478  *
12479  * \return name of the statement as a string i.e. "BEFORE "
12480  *
12481  * \sa Ast::get_nmodl_name
12482  */
12483  std::string get_nmodl_name() const noexcept override { return "BEFORE "; }
12484 
12485  /**
12486  * \brief Get std::shared_ptr from `this` pointer of the current ast node
12487  */
12488  std::shared_ptr<Ast> get_shared_ptr() override {
12489  return std::static_pointer_cast<BeforeBlock>(shared_from_this());
12490  }
12491 
12492  /**
12493  * \brief Get std::shared_ptr from `this` pointer of the current ast node
12494  */
12495  std::shared_ptr<const Ast> get_shared_ptr() const override {
12496  return std::static_pointer_cast<const BeforeBlock>(shared_from_this());
12497  }
12498 
12499  /**
12500  * \brief Return associated token for the current ast node
12501  *
12502  * Not all ast nodes have token information. For example,
12503  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
12504  * solution of ODEs. In this case, we return nullptr to store in the
12505  * nmodl::symtab::SymbolTable.
12506  *
12507  * \return pointer to token if exist otherwise nullptr
12508  */
12509  const ModToken *get_token() const noexcept override { return token.get(); }
12510 
12511  /**
12512  * \brief Return associated symbol table for the current ast node
12513  *
12514  * Only certain ast nodes (e.g. inherited from ast::Block) have associated
12515  * symbol table. These nodes have nmodl::symtab::SymbolTable as member
12516  * and it can be accessed using this method.
12517  *
12518  * \return pointer to the symbol table
12519  *
12520  * \sa nmodl::symtab::SymbolTable nmodl::visitor::SymtabVisitor
12521  */
12522  symtab::SymbolTable *get_symbol_table() const override { return symtab; }
12523 
12524  /**
12525  * \brief Getter for member variable \ref BeforeBlock.bablock
12526  */
12527  const std::shared_ptr<BABlock> &get_bablock() const noexcept {
12528  return bablock;
12529  }
12530 
12531  /// \}
12532 
12533  /// \name Setters
12534  /// \{
12535 
12536  /**
12537  * \brief Set token for the current ast node
12538  */
12539  void set_token(const ModToken &tok) {
12540  token = std::make_shared<ModToken>(tok);
12541  }
12542 
12543  /**
12544  * \brief Set symbol table for the current ast node
12545  *
12546  * Top level, block scoped nodes store symbol table in the ast node.
12547  * nmodl::visitor::SymtabVisitor then used this method to setup symbol table
12548  * for every node in the ast.
12549  *
12550  * \sa nmodl::visitor::SymtabVisitor
12551  */
12552  void set_symbol_table(symtab::SymbolTable *newsymtab) override {
12553  symtab = newsymtab;
12554  }
12555 
12556  /**
12557  * \brief Setter for member variable \ref BeforeBlock.bablock (rvalue
12558  * reference)
12559  */
12560  void set_bablock(std::shared_ptr<BABlock> &&bablock);
12561 
12562  /**
12563  * \brief Setter for member variable \ref BeforeBlock.bablock
12564  */
12565  void set_bablock(const std::shared_ptr<BABlock> &bablock);
12566 
12567  /// \}
12568 
12569  /// \name Visitor
12570  /// \{
12571 
12572  /**
12573  * \brief visit children i.e. member variables of current node using provided
12574  * visitor
12575  *
12576  * Different nodes in the AST have different members (i.e. children). This
12577  * method recursively visits children using provided visitor.
12578  *
12579  * \param v Concrete visitor that will be used to recursively visit children
12580  *
12581  * \sa Ast::visit_children for example.
12582  */
12583  void visit_children(visitor::Visitor &v) override;
12584 
12585  /**
12586  * \brief visit children i.e. member variables of current node using provided
12587  * visitor
12588  *
12589  * Different nodes in the AST have different members (i.e. children). This
12590  * method recursively visits children using provided visitor.
12591  *
12592  * \param v Concrete constant visitor that will be used to recursively visit
12593  * children
12594  *
12595  * \sa Ast::visit_children for example.
12596  */
12597  void visit_children(visitor::ConstVisitor &v) const override;
12598 
12599  /**
12600  * \brief accept (or visit) the current AST node using provided visitor
12601  *
12602  * Instead of visiting children of AST node, like Ast::visit_children,
12603  * accept allows to visit the current node itself using provided concrete
12604  * visitor.
12605  *
12606  * \param v Concrete visitor that will be used to recursively visit node
12607  *
12608  * \sa Ast::accept for example.
12609  */
12610  void accept(visitor::Visitor &v) override;
12611 
12612  /**
12613  * \copydoc accept(visitor::Visitor&)
12614  */
12615  void accept(visitor::ConstVisitor &v) const override;
12616 
12617  /// \}
12618 
12619 private:
12620  /**
12621  * \brief Set this object as parent for all the children
12622  *
12623  * This should be called in every object (with children) constructor
12624  * to set parents. Since it is called only in the constructors it
12625  * should not be virtual to avoid ambiguities (issue #295).
12626  */
12627  void set_parent_in_children();
12628 };
12629 
12630 /** @} */ // end of ast_class
12631 
12632 } // namespace ast
12633 } // namespace nmodl
12634 #endif // !NMODL_AST_BEFORE_BLOCK_HPP
12635 #ifndef NMODL_AST_AFTER_BLOCK_HPP
12636 #define NMODL_AST_AFTER_BLOCK_HPP
12637 
12638 namespace nmodl {
12639 namespace ast {
12640 
12641 /**
12642  * @addtogroup ast_class
12643  * @ingroup ast
12644  * @{
12645  */
12646 
12647 /**
12648  * \brief Represents a `AFTER` block in NMODL
12649  *
12650  * This represents a block to be executed before another block.
12651  * Here is an example of `BEFORE` :
12652  *
12653  * \code{.mod}
12654  * BEFORE STEP {
12655  * if (mode==1) {
12656  * if (ica<imax) {
12657  * imax = ica
12658  * timax = t
12659  * }
12660  * }
12661  * }
12662  * \endcode
12663  *
12664  */
12665 class AfterBlock : public Block {
12666 private:
12667  /// Block to be called after
12668  std::shared_ptr<BABlock> bablock;
12669  /// token with location information
12670  std::shared_ptr<ModToken> token;
12671  /// symbol table for a block
12672  symtab::SymbolTable *symtab = nullptr;
12673 
12674 public:
12675  /// \name Ctor & dtor
12676  /// \{
12677 
12678  explicit AfterBlock(BABlock *bablock);
12679  explicit AfterBlock(const std::shared_ptr<BABlock> &bablock);
12680  AfterBlock(const AfterBlock &obj);
12681 
12682  virtual ~AfterBlock() = default;
12683 
12684  /// \}
12685 
12686  /**
12687  * \brief Check if the ast node is an instance of ast::AfterBlock
12688  * \return true as object is of type ast::AfterBlock
12689  */
12690  bool is_after_block() const noexcept override { return true; }
12691 
12692  /**
12693  * \brief Return a copy of the current node
12694  *
12695  * Recursively make a new copy/clone of the current node including
12696  * all members and return a pointer to the node. This is used for
12697  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
12698  * ast.
12699  *
12700  * @return pointer to the clone/copy of the current node
12701  */
12702  AfterBlock *clone() const override { return new AfterBlock(*this); }
12703 
12704  /// \name Getters
12705  /// \{
12706 
12707  /**
12708  * \brief Return type (ast::AstNodeType) of ast node
12709  *
12710  * Every node in the ast has a type defined in ast::AstNodeType and this
12711  * function is used to retrieve the same.
12712  *
12713  * \return ast node type i.e. ast::AstNodeType::AFTER_BLOCK
12714  *
12715  * \sa Ast::get_node_type_name
12716  */
12717  AstNodeType get_node_type() const noexcept override {
12718  return AstNodeType::AFTER_BLOCK;
12719  }
12720 
12721  /**
12722  * \brief Return type (ast::AstNodeType) of ast node as std::string
12723  *
12724  * Every node in the ast has a type defined in ast::AstNodeType.
12725  * This type name can be returned as a std::string for printing
12726  * node to text/json form.
12727  *
12728  * \return name of the node type as a string i.e. "AfterBlock"
12729  *
12730  * \sa Ast::get_node_name
12731  */
12732  std::string get_node_type_name() const noexcept override {
12733  return "AfterBlock";
12734  }
12735 
12736  /**
12737  * \brief Return NMODL statement of ast node as std::string
12738  *
12739  * Every node is related to a special statement in the NMODL. This
12740  * statement can be returned as a std::string for printing to
12741  * text/json form.
12742  *
12743  * \return name of the statement as a string i.e. "AFTER "
12744  *
12745  * \sa Ast::get_nmodl_name
12746  */
12747  std::string get_nmodl_name() const noexcept override { return "AFTER "; }
12748 
12749  /**
12750  * \brief Get std::shared_ptr from `this` pointer of the current ast node
12751  */
12752  std::shared_ptr<Ast> get_shared_ptr() override {
12753  return std::static_pointer_cast<AfterBlock>(shared_from_this());
12754  }
12755 
12756  /**
12757  * \brief Get std::shared_ptr from `this` pointer of the current ast node
12758  */
12759  std::shared_ptr<const Ast> get_shared_ptr() const override {
12760  return std::static_pointer_cast<const AfterBlock>(shared_from_this());
12761  }
12762 
12763  /**
12764  * \brief Return associated token for the current ast node
12765  *
12766  * Not all ast nodes have token information. For example,
12767  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
12768  * solution of ODEs. In this case, we return nullptr to store in the
12769  * nmodl::symtab::SymbolTable.
12770  *
12771  * \return pointer to token if exist otherwise nullptr
12772  */
12773  const ModToken *get_token() const noexcept override { return token.get(); }
12774 
12775  /**
12776  * \brief Return associated symbol table for the current ast node
12777  *
12778  * Only certain ast nodes (e.g. inherited from ast::Block) have associated
12779  * symbol table. These nodes have nmodl::symtab::SymbolTable as member
12780  * and it can be accessed using this method.
12781  *
12782  * \return pointer to the symbol table
12783  *
12784  * \sa nmodl::symtab::SymbolTable nmodl::visitor::SymtabVisitor
12785  */
12786  symtab::SymbolTable *get_symbol_table() const override { return symtab; }
12787 
12788  /**
12789  * \brief Getter for member variable \ref AfterBlock.bablock
12790  */
12791  const std::shared_ptr<BABlock> &get_bablock() const noexcept {
12792  return bablock;
12793  }
12794 
12795  /// \}
12796 
12797  /// \name Setters
12798  /// \{
12799 
12800  /**
12801  * \brief Set token for the current ast node
12802  */
12803  void set_token(const ModToken &tok) {
12804  token = std::make_shared<ModToken>(tok);
12805  }
12806 
12807  /**
12808  * \brief Set symbol table for the current ast node
12809  *
12810  * Top level, block scoped nodes store symbol table in the ast node.
12811  * nmodl::visitor::SymtabVisitor then used this method to setup symbol table
12812  * for every node in the ast.
12813  *
12814  * \sa nmodl::visitor::SymtabVisitor
12815  */
12816  void set_symbol_table(symtab::SymbolTable *newsymtab) override {
12817  symtab = newsymtab;
12818  }
12819 
12820  /**
12821  * \brief Setter for member variable \ref AfterBlock.bablock (rvalue
12822  * reference)
12823  */
12824  void set_bablock(std::shared_ptr<BABlock> &&bablock);
12825 
12826  /**
12827  * \brief Setter for member variable \ref AfterBlock.bablock
12828  */
12829  void set_bablock(const std::shared_ptr<BABlock> &bablock);
12830 
12831  /// \}
12832 
12833  /// \name Visitor
12834  /// \{
12835 
12836  /**
12837  * \brief visit children i.e. member variables of current node using provided
12838  * visitor
12839  *
12840  * Different nodes in the AST have different members (i.e. children). This
12841  * method recursively visits children using provided visitor.
12842  *
12843  * \param v Concrete visitor that will be used to recursively visit children
12844  *
12845  * \sa Ast::visit_children for example.
12846  */
12847  void visit_children(visitor::Visitor &v) override;
12848 
12849  /**
12850  * \brief visit children i.e. member variables of current node using provided
12851  * visitor
12852  *
12853  * Different nodes in the AST have different members (i.e. children). This
12854  * method recursively visits children using provided visitor.
12855  *
12856  * \param v Concrete constant visitor that will be used to recursively visit
12857  * children
12858  *
12859  * \sa Ast::visit_children for example.
12860  */
12861  void visit_children(visitor::ConstVisitor &v) const override;
12862 
12863  /**
12864  * \brief accept (or visit) the current AST node using provided visitor
12865  *
12866  * Instead of visiting children of AST node, like Ast::visit_children,
12867  * accept allows to visit the current node itself using provided concrete
12868  * visitor.
12869  *
12870  * \param v Concrete visitor that will be used to recursively visit node
12871  *
12872  * \sa Ast::accept for example.
12873  */
12874  void accept(visitor::Visitor &v) override;
12875 
12876  /**
12877  * \copydoc accept(visitor::Visitor&)
12878  */
12879  void accept(visitor::ConstVisitor &v) const override;
12880 
12881  /// \}
12882 
12883 private:
12884  /**
12885  * \brief Set this object as parent for all the children
12886  *
12887  * This should be called in every object (with children) constructor
12888  * to set parents. Since it is called only in the constructors it
12889  * should not be virtual to avoid ambiguities (issue #295).
12890  */
12891  void set_parent_in_children();
12892 };
12893 
12894 /** @} */ // end of ast_class
12895 
12896 } // namespace ast
12897 } // namespace nmodl
12898 #endif // !NMODL_AST_AFTER_BLOCK_HPP
12899 #ifndef NMODL_AST_BA_BLOCK_HPP
12900 #define NMODL_AST_BA_BLOCK_HPP
12901 
12902 namespace nmodl {
12903 namespace ast {
12904 
12905 /**
12906  * @addtogroup ast_class
12907  * @ingroup ast
12908  * @{
12909  */
12910 
12911 /**
12912  * \brief Represents a block to be executed before or after another block
12913  *
12914  * This represents a block to be executed before or after another
12915  * block in NMODL. See ast::BeforeBlock and ast::AfterBlock for usage.
12916  *
12917  */
12918 class BABlock : public Block {
12919 private:
12920  /// Type of NMODL block
12921  std::shared_ptr<BABlockType> type;
12922  /// Block with statements vector
12923  std::shared_ptr<StatementBlock> statement_block;
12924  /// token with location information
12925  std::shared_ptr<ModToken> token;
12926  /// symbol table for a block
12927  symtab::SymbolTable *symtab = nullptr;
12928 
12929 public:
12930  /// \name Ctor & dtor
12931  /// \{
12932 
12933  explicit BABlock(BABlockType *type, StatementBlock *statement_block);
12934  explicit BABlock(const std::shared_ptr<BABlockType> &type,
12935  const std::shared_ptr<StatementBlock> &statement_block);
12936  BABlock(const BABlock &obj);
12937 
12938  virtual ~BABlock() = default;
12939 
12940  /// \}
12941 
12942  /**
12943  * \brief Check if the ast node is an instance of ast::BABlock
12944  * \return true as object is of type ast::BABlock
12945  */
12946  bool is_ba_block() const noexcept override { return true; }
12947 
12948  /**
12949  * \brief Return a copy of the current node
12950  *
12951  * Recursively make a new copy/clone of the current node including
12952  * all members and return a pointer to the node. This is used for
12953  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
12954  * ast.
12955  *
12956  * @return pointer to the clone/copy of the current node
12957  */
12958  BABlock *clone() const override { return new BABlock(*this); }
12959 
12960  /// \name Getters
12961  /// \{
12962 
12963  /**
12964  * \brief Return type (ast::AstNodeType) of ast node
12965  *
12966  * Every node in the ast has a type defined in ast::AstNodeType and this
12967  * function is used to retrieve the same.
12968  *
12969  * \return ast node type i.e. ast::AstNodeType::BA_BLOCK
12970  *
12971  * \sa Ast::get_node_type_name
12972  */
12973  AstNodeType get_node_type() const noexcept override {
12974  return AstNodeType::BA_BLOCK;
12975  }
12976 
12977  /**
12978  * \brief Return type (ast::AstNodeType) of ast node as std::string
12979  *
12980  * Every node in the ast has a type defined in ast::AstNodeType.
12981  * This type name can be returned as a std::string for printing
12982  * node to text/json form.
12983  *
12984  * \return name of the node type as a string i.e. "BABlock"
12985  *
12986  * \sa Ast::get_node_name
12987  */
12988  std::string get_node_type_name() const noexcept override { return "BABlock"; }
12989 
12990  /**
12991  * \brief Get std::shared_ptr from `this` pointer of the current ast node
12992  */
12993  std::shared_ptr<Ast> get_shared_ptr() override {
12994  return std::static_pointer_cast<BABlock>(shared_from_this());
12995  }
12996 
12997  /**
12998  * \brief Get std::shared_ptr from `this` pointer of the current ast node
12999  */
13000  std::shared_ptr<const Ast> get_shared_ptr() const override {
13001  return std::static_pointer_cast<const BABlock>(shared_from_this());
13002  }
13003 
13004  /**
13005  * \brief Return associated token for the current ast node
13006  *
13007  * Not all ast nodes have token information. For example,
13008  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
13009  * solution of ODEs. In this case, we return nullptr to store in the
13010  * nmodl::symtab::SymbolTable.
13011  *
13012  * \return pointer to token if exist otherwise nullptr
13013  */
13014  const ModToken *get_token() const noexcept override { return token.get(); }
13015 
13016  /**
13017  * \brief Return associated symbol table for the current ast node
13018  *
13019  * Only certain ast nodes (e.g. inherited from ast::Block) have associated
13020  * symbol table. These nodes have nmodl::symtab::SymbolTable as member
13021  * and it can be accessed using this method.
13022  *
13023  * \return pointer to the symbol table
13024  *
13025  * \sa nmodl::symtab::SymbolTable nmodl::visitor::SymtabVisitor
13026  */
13027  symtab::SymbolTable *get_symbol_table() const override { return symtab; }
13028 
13029  /**
13030  * \brief Getter for member variable \ref BABlock.type
13031  */
13032  const std::shared_ptr<BABlockType> &get_type() const noexcept { return type; }
13033 
13034  /**
13035  * \brief Getter for member variable \ref BABlock.statement_block
13036  */
13037  const std::shared_ptr<StatementBlock> &get_statement_block() const
13038  noexcept override {
13039  return statement_block;
13040  }
13041 
13042  /// \}
13043 
13044  /// \name Setters
13045  /// \{
13046 
13047  /**
13048  * \brief Set token for the current ast node
13049  */
13050  void set_token(const ModToken &tok) {
13051  token = std::make_shared<ModToken>(tok);
13052  }
13053 
13054  /**
13055  * \brief Set symbol table for the current ast node
13056  *
13057  * Top level, block scoped nodes store symbol table in the ast node.
13058  * nmodl::visitor::SymtabVisitor then used this method to setup symbol table
13059  * for every node in the ast.
13060  *
13061  * \sa nmodl::visitor::SymtabVisitor
13062  */
13063  void set_symbol_table(symtab::SymbolTable *newsymtab) override {
13064  symtab = newsymtab;
13065  }
13066 
13067  /**
13068  * \brief Setter for member variable \ref BABlock.type (rvalue reference)
13069  */
13070  void set_type(std::shared_ptr<BABlockType> &&type);
13071 
13072  /**
13073  * \brief Setter for member variable \ref BABlock.type
13074  */
13075  void set_type(const std::shared_ptr<BABlockType> &type);
13076 
13077  /**
13078  * \brief Setter for member variable \ref BABlock.statement_block (rvalue
13079  * reference)
13080  */
13081  void set_statement_block(std::shared_ptr<StatementBlock> &&statement_block);
13082 
13083  /**
13084  * \brief Setter for member variable \ref BABlock.statement_block
13085  */
13086  void
13087  set_statement_block(const std::shared_ptr<StatementBlock> &statement_block);
13088 
13089  /// \}
13090 
13091  /// \name Visitor
13092  /// \{
13093 
13094  /**
13095  * \brief visit children i.e. member variables of current node using provided
13096  * visitor
13097  *
13098  * Different nodes in the AST have different members (i.e. children). This
13099  * method recursively visits children using provided visitor.
13100  *
13101  * \param v Concrete visitor that will be used to recursively visit children
13102  *
13103  * \sa Ast::visit_children for example.
13104  */
13105  void visit_children(visitor::Visitor &v) override;
13106 
13107  /**
13108  * \brief visit children i.e. member variables of current node using provided
13109  * visitor
13110  *
13111  * Different nodes in the AST have different members (i.e. children). This
13112  * method recursively visits children using provided visitor.
13113  *
13114  * \param v Concrete constant visitor that will be used to recursively visit
13115  * children
13116  *
13117  * \sa Ast::visit_children for example.
13118  */
13119  void visit_children(visitor::ConstVisitor &v) const override;
13120 
13121  /**
13122  * \brief accept (or visit) the current AST node using provided visitor
13123  *
13124  * Instead of visiting children of AST node, like Ast::visit_children,
13125  * accept allows to visit the current node itself using provided concrete
13126  * visitor.
13127  *
13128  * \param v Concrete visitor that will be used to recursively visit node
13129  *
13130  * \sa Ast::accept for example.
13131  */
13132  void accept(visitor::Visitor &v) override;
13133 
13134  /**
13135  * \copydoc accept(visitor::Visitor&)
13136  */
13137  void accept(visitor::ConstVisitor &v) const override;
13138 
13139  /// \}
13140 
13141 private:
13142  /**
13143  * \brief Set this object as parent for all the children
13144  *
13145  * This should be called in every object (with children) constructor
13146  * to set parents. Since it is called only in the constructors it
13147  * should not be virtual to avoid ambiguities (issue #295).
13148  */
13149  void set_parent_in_children();
13150 };
13151 
13152 /** @} */ // end of ast_class
13153 
13154 } // namespace ast
13155 } // namespace nmodl
13156 #endif // !NMODL_AST_BA_BLOCK_HPP
13157 #ifndef NMODL_AST_FOR_NETCON_HPP
13158 #define NMODL_AST_FOR_NETCON_HPP
13159 
13160 namespace nmodl {
13161 namespace ast {
13162 
13163 /**
13164  * @addtogroup ast_class
13165  * @ingroup ast
13166  * @{
13167  */
13168 
13169 /**
13170  * \brief TODO
13171  *
13172  *
13173  */
13174 class ForNetcon : public Block {
13175 private:
13176  /// Arguments to the for netcon block
13178  /// Block with statements vector
13179  std::shared_ptr<StatementBlock> statement_block;
13180  /// token with location information
13181  std::shared_ptr<ModToken> token;
13182  /// symbol table for a block
13183  symtab::SymbolTable *symtab = nullptr;
13184 
13185 public:
13186  /// \name Ctor & dtor
13187  /// \{
13188 
13189  explicit ForNetcon(ArgumentVector parameters,
13190  StatementBlock *statement_block);
13191  explicit ForNetcon(const ArgumentVector &parameters,
13192  const std::shared_ptr<StatementBlock> &statement_block);
13193  ForNetcon(const ForNetcon &obj);
13194 
13195  virtual ~ForNetcon() = default;
13196 
13197  /// \}
13198 
13199  /**
13200  * \brief Check if the ast node is an instance of ast::ForNetcon
13201  * \return true as object is of type ast::ForNetcon
13202  */
13203  bool is_for_netcon() const noexcept override { return true; }
13204 
13205  /**
13206  * \brief Return a copy of the current node
13207  *
13208  * Recursively make a new copy/clone of the current node including
13209  * all members and return a pointer to the node. This is used for
13210  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
13211  * ast.
13212  *
13213  * @return pointer to the clone/copy of the current node
13214  */
13215  ForNetcon *clone() const override { return new ForNetcon(*this); }
13216 
13217  /// \name Getters
13218  /// \{
13219 
13220  /**
13221  * \brief Return type (ast::AstNodeType) of ast node
13222  *
13223  * Every node in the ast has a type defined in ast::AstNodeType and this
13224  * function is used to retrieve the same.
13225  *
13226  * \return ast node type i.e. ast::AstNodeType::FOR_NETCON
13227  *
13228  * \sa Ast::get_node_type_name
13229  */
13230  AstNodeType get_node_type() const noexcept override {
13231  return AstNodeType::FOR_NETCON;
13232  }
13233 
13234  /**
13235  * \brief Return type (ast::AstNodeType) of ast node as std::string
13236  *
13237  * Every node in the ast has a type defined in ast::AstNodeType.
13238  * This type name can be returned as a std::string for printing
13239  * node to text/json form.
13240  *
13241  * \return name of the node type as a string i.e. "ForNetcon"
13242  *
13243  * \sa Ast::get_node_name
13244  */
13245  std::string get_node_type_name() const noexcept override {
13246  return "ForNetcon";
13247  }
13248 
13249  /**
13250  * \brief Return NMODL statement of ast node as std::string
13251  *
13252  * Every node is related to a special statement in the NMODL. This
13253  * statement can be returned as a std::string for printing to
13254  * text/json form.
13255  *
13256  * \return name of the statement as a string i.e. "FOR_NETCONS "
13257  *
13258  * \sa Ast::get_nmodl_name
13259  */
13260  std::string get_nmodl_name() const noexcept override {
13261  return "FOR_NETCONS ";
13262  }
13263 
13264  /**
13265  * \brief Get std::shared_ptr from `this` pointer of the current ast node
13266  */
13267  std::shared_ptr<Ast> get_shared_ptr() override {
13268  return std::static_pointer_cast<ForNetcon>(shared_from_this());
13269  }
13270 
13271  /**
13272  * \brief Get std::shared_ptr from `this` pointer of the current ast node
13273  */
13274  std::shared_ptr<const Ast> get_shared_ptr() const override {
13275  return std::static_pointer_cast<const ForNetcon>(shared_from_this());
13276  }
13277 
13278  /**
13279  * \brief Return associated token for the current ast node
13280  *
13281  * Not all ast nodes have token information. For example,
13282  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
13283  * solution of ODEs. In this case, we return nullptr to store in the
13284  * nmodl::symtab::SymbolTable.
13285  *
13286  * \return pointer to token if exist otherwise nullptr
13287  */
13288  const ModToken *get_token() const noexcept override { return token.get(); }
13289 
13290  /**
13291  * \brief Return associated symbol table for the current ast node
13292  *
13293  * Only certain ast nodes (e.g. inherited from ast::Block) have associated
13294  * symbol table. These nodes have nmodl::symtab::SymbolTable as member
13295  * and it can be accessed using this method.
13296  *
13297  * \return pointer to the symbol table
13298  *
13299  * \sa nmodl::symtab::SymbolTable nmodl::visitor::SymtabVisitor
13300  */
13301  symtab::SymbolTable *get_symbol_table() const override { return symtab; }
13302 
13303  /**
13304  * \brief Getter for member variable \ref ForNetcon.parameters
13305  */
13306  const ArgumentVector &get_parameters() const noexcept override {
13307  return parameters;
13308  }
13309 
13310  /**
13311  * \brief Getter for member variable \ref ForNetcon.statement_block
13312  */
13313  const std::shared_ptr<StatementBlock> &get_statement_block() const
13314  noexcept override {
13315  return statement_block;
13316  }
13317 
13318  /// \}
13319 
13320  /// \name Setters
13321  /// \{
13322 
13323  /**
13324  * \brief Set token for the current ast node
13325  */
13326  void set_token(const ModToken &tok) {
13327  token = std::make_shared<ModToken>(tok);
13328  }
13329 
13330  /**
13331  * \brief Set symbol table for the current ast node
13332  *
13333  * Top level, block scoped nodes store symbol table in the ast node.
13334  * nmodl::visitor::SymtabVisitor then used this method to setup symbol table
13335  * for every node in the ast.
13336  *
13337  * \sa nmodl::visitor::SymtabVisitor
13338  */
13339  void set_symbol_table(symtab::SymbolTable *newsymtab) override {
13340  symtab = newsymtab;
13341  }
13342 
13343  /**
13344  * \brief Setter for member variable \ref ForNetcon.parameters (rvalue
13345  * reference)
13346  */
13347  void set_parameters(ArgumentVector &&parameters);
13348 
13349  /**
13350  * \brief Setter for member variable \ref ForNetcon.parameters
13351  */
13352  void set_parameters(const ArgumentVector &parameters);
13353 
13354  /**
13355  * \brief Setter for member variable \ref ForNetcon.statement_block (rvalue
13356  * reference)
13357  */
13358  void set_statement_block(std::shared_ptr<StatementBlock> &&statement_block);
13359 
13360  /**
13361  * \brief Setter for member variable \ref ForNetcon.statement_block
13362  */
13363  void
13364  set_statement_block(const std::shared_ptr<StatementBlock> &statement_block);
13365 
13366  /// \}
13367 
13368  /// \name Visitor
13369  /// \{
13370 
13371  /**
13372  * \brief visit children i.e. member variables of current node using provided
13373  * visitor
13374  *
13375  * Different nodes in the AST have different members (i.e. children). This
13376  * method recursively visits children using provided visitor.
13377  *
13378  * \param v Concrete visitor that will be used to recursively visit children
13379  *
13380  * \sa Ast::visit_children for example.
13381  */
13382  void visit_children(visitor::Visitor &v) override;
13383 
13384  /**
13385  * \brief visit children i.e. member variables of current node using provided
13386  * visitor
13387  *
13388  * Different nodes in the AST have different members (i.e. children). This
13389  * method recursively visits children using provided visitor.
13390  *
13391  * \param v Concrete constant visitor that will be used to recursively visit
13392  * children
13393  *
13394  * \sa Ast::visit_children for example.
13395  */
13396  void visit_children(visitor::ConstVisitor &v) const override;
13397 
13398  /**
13399  * \brief accept (or visit) the current AST node using provided visitor
13400  *
13401  * Instead of visiting children of AST node, like Ast::visit_children,
13402  * accept allows to visit the current node itself using provided concrete
13403  * visitor.
13404  *
13405  * \param v Concrete visitor that will be used to recursively visit node
13406  *
13407  * \sa Ast::accept for example.
13408  */
13409  void accept(visitor::Visitor &v) override;
13410 
13411  /**
13412  * \copydoc accept(visitor::Visitor&)
13413  */
13414  void accept(visitor::ConstVisitor &v) const override;
13415 
13416  /// \}
13417 
13418 private:
13419  /**
13420  * \brief Set this object as parent for all the children
13421  *
13422  * This should be called in every object (with children) constructor
13423  * to set parents. Since it is called only in the constructors it
13424  * should not be virtual to avoid ambiguities (issue #295).
13425  */
13426  void set_parent_in_children();
13427 };
13428 
13429 /** @} */ // end of ast_class
13430 
13431 } // namespace ast
13432 } // namespace nmodl
13433 #endif // !NMODL_AST_FOR_NETCON_HPP
13434 #ifndef NMODL_AST_KINETIC_BLOCK_HPP
13435 #define NMODL_AST_KINETIC_BLOCK_HPP
13436 
13437 namespace nmodl {
13438 namespace ast {
13439 
13440 /**
13441  * @addtogroup ast_class
13442  * @ingroup ast
13443  * @{
13444  */
13445 
13446 /**
13447  * \brief TODO
13448  *
13449  *
13450  */
13451 class KineticBlock : public Block {
13452 private:
13453  /// Name of the kinetic block
13454  std::shared_ptr<Name> name;
13455  /// Solve for specification (TODO)
13457  /// Block with statements vector
13458  std::shared_ptr<StatementBlock> statement_block;
13459  /// token with location information
13460  std::shared_ptr<ModToken> token;
13461  /// symbol table for a block
13462  symtab::SymbolTable *symtab = nullptr;
13463 
13464 public:
13465  /// \name Ctor & dtor
13466  /// \{
13467 
13468  explicit KineticBlock(Name *name, NameVector solvefor,
13469  StatementBlock *statement_block);
13470  explicit KineticBlock(const std::shared_ptr<Name> &name,
13471  const NameVector &solvefor,
13472  const std::shared_ptr<StatementBlock> &statement_block);
13473  KineticBlock(const KineticBlock &obj);
13474 
13475  virtual ~KineticBlock() = default;
13476 
13477  /// \}
13478 
13479  /**
13480  * \brief Check if the ast node is an instance of ast::KineticBlock
13481  * \return true as object is of type ast::KineticBlock
13482  */
13483  bool is_kinetic_block() const noexcept override { return true; }
13484 
13485  /**
13486  * \brief Return a copy of the current node
13487  *
13488  * Recursively make a new copy/clone of the current node including
13489  * all members and return a pointer to the node. This is used for
13490  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
13491  * ast.
13492  *
13493  * @return pointer to the clone/copy of the current node
13494  */
13495  KineticBlock *clone() const override { return new KineticBlock(*this); }
13496 
13497  /// \name Getters
13498  /// \{
13499 
13500  /**
13501  * \brief Return type (ast::AstNodeType) of ast node
13502  *
13503  * Every node in the ast has a type defined in ast::AstNodeType and this
13504  * function is used to retrieve the same.
13505  *
13506  * \return ast node type i.e. ast::AstNodeType::KINETIC_BLOCK
13507  *
13508  * \sa Ast::get_node_type_name
13509  */
13510  AstNodeType get_node_type() const noexcept override {
13512  }
13513 
13514  /**
13515  * \brief Return type (ast::AstNodeType) of ast node as std::string
13516  *
13517  * Every node in the ast has a type defined in ast::AstNodeType.
13518  * This type name can be returned as a std::string for printing
13519  * node to text/json form.
13520  *
13521  * \return name of the node type as a string i.e. "KineticBlock"
13522  *
13523  * \sa Ast::get_node_name
13524  */
13525  std::string get_node_type_name() const noexcept override {
13526  return "KineticBlock";
13527  }
13528 
13529  /**
13530  * \brief Return NMODL statement of ast node as std::string
13531  *
13532  * Every node is related to a special statement in the NMODL. This
13533  * statement can be returned as a std::string for printing to
13534  * text/json form.
13535  *
13536  * \return name of the statement as a string i.e. "KINETIC "
13537  *
13538  * \sa Ast::get_nmodl_name
13539  */
13540  std::string get_nmodl_name() const noexcept override { return "KINETIC "; }
13541 
13542  /**
13543  * \brief Get std::shared_ptr from `this` pointer of the current ast node
13544  */
13545  std::shared_ptr<Ast> get_shared_ptr() override {
13546  return std::static_pointer_cast<KineticBlock>(shared_from_this());
13547  }
13548 
13549  /**
13550  * \brief Get std::shared_ptr from `this` pointer of the current ast node
13551  */
13552  std::shared_ptr<const Ast> get_shared_ptr() const override {
13553  return std::static_pointer_cast<const KineticBlock>(shared_from_this());
13554  }
13555 
13556  /**
13557  * \brief Return associated token for the current ast node
13558  *
13559  * Not all ast nodes have token information. For example,
13560  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
13561  * solution of ODEs. In this case, we return nullptr to store in the
13562  * nmodl::symtab::SymbolTable.
13563  *
13564  * \return pointer to token if exist otherwise nullptr
13565  */
13566  const ModToken *get_token() const noexcept override { return token.get(); }
13567 
13568  /**
13569  * \brief Return associated symbol table for the current ast node
13570  *
13571  * Only certain ast nodes (e.g. inherited from ast::Block) have associated
13572  * symbol table. These nodes have nmodl::symtab::SymbolTable as member
13573  * and it can be accessed using this method.
13574  *
13575  * \return pointer to the symbol table
13576  *
13577  * \sa nmodl::symtab::SymbolTable nmodl::visitor::SymtabVisitor
13578  */
13579  symtab::SymbolTable *get_symbol_table() const override { return symtab; }
13580 
13581  /**
13582  * \brief Return name of the node
13583  *
13584  * Some ast nodes have a member marked designated as node name. For example,
13585  * in case of this ast::Name has name designated as a
13586  * node name.
13587  *
13588  * @return name of the node as std::string
13589  *
13590  * \sa Ast::get_node_type_name
13591  */
13592  std::string get_node_name() const override;
13593 
13594  /**
13595  * \brief Getter for member variable \ref KineticBlock.name
13596  */
13597  const std::shared_ptr<Name> &get_name() const noexcept { return name; }
13598 
13599  /**
13600  * \brief Getter for member variable \ref KineticBlock.solvefor
13601  */
13602  const NameVector &get_solvefor() const noexcept { return solvefor; }
13603 
13604  /**
13605  * \brief Getter for member variable \ref KineticBlock.statement_block
13606  */
13607  const std::shared_ptr<StatementBlock> &get_statement_block() const
13608  noexcept override {
13609  return statement_block;
13610  }
13611 
13612  /// \}
13613 
13614  /// \name Setters
13615  /// \{
13616 
13617  /**
13618  * \brief Set token for the current ast node
13619  */
13620  void set_token(const ModToken &tok) {
13621  token = std::make_shared<ModToken>(tok);
13622  }
13623 
13624  /**
13625  * \brief Set symbol table for the current ast node
13626  *
13627  * Top level, block scoped nodes store symbol table in the ast node.
13628  * nmodl::visitor::SymtabVisitor then used this method to setup symbol table
13629  * for every node in the ast.
13630  *
13631  * \sa nmodl::visitor::SymtabVisitor
13632  */
13633  void set_symbol_table(symtab::SymbolTable *newsymtab) override {
13634  symtab = newsymtab;
13635  }
13636 
13637  /**
13638  * \brief Setter for member variable \ref KineticBlock.name (rvalue reference)
13639  */
13640  void set_name(std::shared_ptr<Name> &&name);
13641 
13642  /**
13643  * \brief Setter for member variable \ref KineticBlock.name
13644  */
13645  void set_name(const std::shared_ptr<Name> &name);
13646 
13647  /**
13648  * \brief Setter for member variable \ref KineticBlock.solvefor (rvalue
13649  * reference)
13650  */
13651  void set_solvefor(NameVector &&solvefor);
13652 
13653  /**
13654  * \brief Setter for member variable \ref KineticBlock.solvefor
13655  */
13656  void set_solvefor(const NameVector &solvefor);
13657 
13658  /**
13659  * \brief Setter for member variable \ref KineticBlock.statement_block (rvalue
13660  * reference)
13661  */
13662  void set_statement_block(std::shared_ptr<StatementBlock> &&statement_block);
13663 
13664  /**
13665  * \brief Setter for member variable \ref KineticBlock.statement_block
13666  */
13667  void
13668  set_statement_block(const std::shared_ptr<StatementBlock> &statement_block);
13669 
13670  /// \}
13671 
13672  /// \name Visitor
13673  /// \{
13674 
13675  /**
13676  * \brief visit children i.e. member variables of current node using provided
13677  * visitor
13678  *
13679  * Different nodes in the AST have different members (i.e. children). This
13680  * method recursively visits children using provided visitor.
13681  *
13682  * \param v Concrete visitor that will be used to recursively visit children
13683  *
13684  * \sa Ast::visit_children for example.
13685  */
13686  void visit_children(visitor::Visitor &v) override;
13687 
13688  /**
13689  * \brief visit children i.e. member variables of current node using provided
13690  * visitor
13691  *
13692  * Different nodes in the AST have different members (i.e. children). This
13693  * method recursively visits children using provided visitor.
13694  *
13695  * \param v Concrete constant visitor that will be used to recursively visit
13696  * children
13697  *
13698  * \sa Ast::visit_children for example.
13699  */
13700  void visit_children(visitor::ConstVisitor &v) const override;
13701 
13702  /**
13703  * \brief accept (or visit) the current AST node using provided visitor
13704  *
13705  * Instead of visiting children of AST node, like Ast::visit_children,
13706  * accept allows to visit the current node itself using provided concrete
13707  * visitor.
13708  *
13709  * \param v Concrete visitor that will be used to recursively visit node
13710  *
13711  * \sa Ast::accept for example.
13712  */
13713  void accept(visitor::Visitor &v) override;
13714 
13715  /**
13716  * \copydoc accept(visitor::Visitor&)
13717  */
13718  void accept(visitor::ConstVisitor &v) const override;
13719 
13720  /// \}
13721 
13722 private:
13723  /**
13724  * \brief Set this object as parent for all the children
13725  *
13726  * This should be called in every object (with children) constructor
13727  * to set parents. Since it is called only in the constructors it
13728  * should not be virtual to avoid ambiguities (issue #295).
13729  */
13730  void set_parent_in_children();
13731 };
13732 
13733 /** @} */ // end of ast_class
13734 
13735 } // namespace ast
13736 } // namespace nmodl
13737 #endif // !NMODL_AST_KINETIC_BLOCK_HPP
13738 #ifndef NMODL_AST_MATCH_BLOCK_HPP
13739 #define NMODL_AST_MATCH_BLOCK_HPP
13740 
13741 namespace nmodl {
13742 namespace ast {
13743 
13744 /**
13745  * @addtogroup ast_class
13746  * @ingroup ast
13747  * @{
13748  */
13749 
13750 /**
13751  * \brief TODO
13752  *
13753  *
13754  */
13755 class MatchBlock : public Block {
13756 private:
13757  /// Vector of match statements
13759  /// token with location information
13760  std::shared_ptr<ModToken> token;
13761  /// symbol table for a block
13762  symtab::SymbolTable *symtab = nullptr;
13763 
13764 public:
13765  /// \name Ctor & dtor
13766  /// \{
13767 
13768  explicit MatchBlock(MatchVector matchs);
13769  MatchBlock(const MatchBlock &obj);
13770 
13771  virtual ~MatchBlock() = default;
13772 
13773  /// \}
13774 
13775  /**
13776  * \brief Check if the ast node is an instance of ast::MatchBlock
13777  * \return true as object is of type ast::MatchBlock
13778  */
13779  bool is_match_block() const noexcept override { return true; }
13780 
13781  /**
13782  * \brief Return a copy of the current node
13783  *
13784  * Recursively make a new copy/clone of the current node including
13785  * all members and return a pointer to the node. This is used for
13786  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
13787  * ast.
13788  *
13789  * @return pointer to the clone/copy of the current node
13790  */
13791  MatchBlock *clone() const override { return new MatchBlock(*this); }
13792 
13793  /// \name Getters
13794  /// \{
13795 
13796  /**
13797  * \brief Return type (ast::AstNodeType) of ast node
13798  *
13799  * Every node in the ast has a type defined in ast::AstNodeType and this
13800  * function is used to retrieve the same.
13801  *
13802  * \return ast node type i.e. ast::AstNodeType::MATCH_BLOCK
13803  *
13804  * \sa Ast::get_node_type_name
13805  */
13806  AstNodeType get_node_type() const noexcept override {
13807  return AstNodeType::MATCH_BLOCK;
13808  }
13809 
13810  /**
13811  * \brief Return type (ast::AstNodeType) of ast node as std::string
13812  *
13813  * Every node in the ast has a type defined in ast::AstNodeType.
13814  * This type name can be returned as a std::string for printing
13815  * node to text/json form.
13816  *
13817  * \return name of the node type as a string i.e. "MatchBlock"
13818  *
13819  * \sa Ast::get_node_name
13820  */
13821  std::string get_node_type_name() const noexcept override {
13822  return "MatchBlock";
13823  }
13824 
13825  /**
13826  * \brief Return NMODL statement of ast node as std::string
13827  *
13828  * Every node is related to a special statement in the NMODL. This
13829  * statement can be returned as a std::string for printing to
13830  * text/json form.
13831  *
13832  * \return name of the statement as a string i.e. "MATCH"
13833  *
13834  * \sa Ast::get_nmodl_name
13835  */
13836  std::string get_nmodl_name() const noexcept override { return "MATCH"; }
13837 
13838  /**
13839  * \brief Get std::shared_ptr from `this` pointer of the current ast node
13840  */
13841  std::shared_ptr<Ast> get_shared_ptr() override {
13842  return std::static_pointer_cast<MatchBlock>(shared_from_this());
13843  }
13844 
13845  /**
13846  * \brief Get std::shared_ptr from `this` pointer of the current ast node
13847  */
13848  std::shared_ptr<const Ast> get_shared_ptr() const override {
13849  return std::static_pointer_cast<const MatchBlock>(shared_from_this());
13850  }
13851 
13852  /**
13853  * \brief Return associated token for the current ast node
13854  *
13855  * Not all ast nodes have token information. For example,
13856  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
13857  * solution of ODEs. In this case, we return nullptr to store in the
13858  * nmodl::symtab::SymbolTable.
13859  *
13860  * \return pointer to token if exist otherwise nullptr
13861  */
13862  const ModToken *get_token() const noexcept override { return token.get(); }
13863 
13864  /**
13865  * \brief Return associated symbol table for the current ast node
13866  *
13867  * Only certain ast nodes (e.g. inherited from ast::Block) have associated
13868  * symbol table. These nodes have nmodl::symtab::SymbolTable as member
13869  * and it can be accessed using this method.
13870  *
13871  * \return pointer to the symbol table
13872  *
13873  * \sa nmodl::symtab::SymbolTable nmodl::visitor::SymtabVisitor
13874  */
13875  symtab::SymbolTable *get_symbol_table() const override { return symtab; }
13876 
13877  /**
13878  * \brief Getter for member variable \ref MatchBlock.matchs
13879  */
13880  const MatchVector &get_matchs() const noexcept { return matchs; }
13881 
13882  /// \}
13883 
13884  /// \name Setters
13885  /// \{
13886 
13887  /**
13888  * \brief Set token for the current ast node
13889  */
13890  void set_token(const ModToken &tok) {
13891  token = std::make_shared<ModToken>(tok);
13892  }
13893 
13894  /**
13895  * \brief Set symbol table for the current ast node
13896  *
13897  * Top level, block scoped nodes store symbol table in the ast node.
13898  * nmodl::visitor::SymtabVisitor then used this method to setup symbol table
13899  * for every node in the ast.
13900  *
13901  * \sa nmodl::visitor::SymtabVisitor
13902  */
13903  void set_symbol_table(symtab::SymbolTable *newsymtab) override {
13904  symtab = newsymtab;
13905  }
13906 
13907  /**
13908  * \brief Setter for member variable \ref MatchBlock.matchs (rvalue reference)
13909  */
13910  void set_matchs(MatchVector &&matchs);
13911 
13912  /**
13913  * \brief Setter for member variable \ref MatchBlock.matchs
13914  */
13915  void set_matchs(const MatchVector &matchs);
13916 
13917  /// \}
13918 
13919  /// \name Visitor
13920  /// \{
13921 
13922  /**
13923  * \brief visit children i.e. member variables of current node using provided
13924  * visitor
13925  *
13926  * Different nodes in the AST have different members (i.e. children). This
13927  * method recursively visits children using provided visitor.
13928  *
13929  * \param v Concrete visitor that will be used to recursively visit children
13930  *
13931  * \sa Ast::visit_children for example.
13932  */
13933  void visit_children(visitor::Visitor &v) override;
13934 
13935  /**
13936  * \brief visit children i.e. member variables of current node using provided
13937  * visitor
13938  *
13939  * Different nodes in the AST have different members (i.e. children). This
13940  * method recursively visits children using provided visitor.
13941  *
13942  * \param v Concrete constant visitor that will be used to recursively visit
13943  * children
13944  *
13945  * \sa Ast::visit_children for example.
13946  */
13947  void visit_children(visitor::ConstVisitor &v) const override;
13948 
13949  /**
13950  * \brief accept (or visit) the current AST node using provided visitor
13951  *
13952  * Instead of visiting children of AST node, like Ast::visit_children,
13953  * accept allows to visit the current node itself using provided concrete
13954  * visitor.
13955  *
13956  * \param v Concrete visitor that will be used to recursively visit node
13957  *
13958  * \sa Ast::accept for example.
13959  */
13960  void accept(visitor::Visitor &v) override;
13961 
13962  /**
13963  * \copydoc accept(visitor::Visitor&)
13964  */
13965  void accept(visitor::ConstVisitor &v) const override;
13966 
13967  /// \}
13968 
13969 private:
13970  /**
13971  * \brief Set this object as parent for all the children
13972  *
13973  * This should be called in every object (with children) constructor
13974  * to set parents. Since it is called only in the constructors it
13975  * should not be virtual to avoid ambiguities (issue #295).
13976  */
13977  void set_parent_in_children();
13978 };
13979 
13980 /** @} */ // end of ast_class
13981 
13982 } // namespace ast
13983 } // namespace nmodl
13984 #endif // !NMODL_AST_MATCH_BLOCK_HPP
13985 #ifndef NMODL_AST_UNIT_BLOCK_HPP
13986 #define NMODL_AST_UNIT_BLOCK_HPP
13987 
13988 namespace nmodl {
13989 namespace ast {
13990 
13991 /**
13992  * @addtogroup ast_class
13993  * @ingroup ast
13994  * @{
13995  */
13996 
13997 /**
13998  * \brief TODO
13999  *
14000  *
14001  */
14002 class UnitBlock : public Block {
14003 private:
14004  /// Vector of unit statements
14006  /// token with location information
14007  std::shared_ptr<ModToken> token;
14008  /// symbol table for a block
14009  symtab::SymbolTable *symtab = nullptr;
14010 
14011 public:
14012  /// \name Ctor & dtor
14013  /// \{
14014 
14015  explicit UnitBlock(ExpressionVector definitions);
14016  UnitBlock(const UnitBlock &obj);
14017 
14018  virtual ~UnitBlock() = default;
14019 
14020  /// \}
14021 
14022  /**
14023  * \brief Check if the ast node is an instance of ast::UnitBlock
14024  * \return true as object is of type ast::UnitBlock
14025  */
14026  bool is_unit_block() const noexcept override { return true; }
14027 
14028  /**
14029  * \brief Return a copy of the current node
14030  *
14031  * Recursively make a new copy/clone of the current node including
14032  * all members and return a pointer to the node. This is used for
14033  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
14034  * ast.
14035  *
14036  * @return pointer to the clone/copy of the current node
14037  */
14038  UnitBlock *clone() const override { return new UnitBlock(*this); }
14039 
14040  /// \name Getters
14041  /// \{
14042 
14043  /**
14044  * \brief Return type (ast::AstNodeType) of ast node
14045  *
14046  * Every node in the ast has a type defined in ast::AstNodeType and this
14047  * function is used to retrieve the same.
14048  *
14049  * \return ast node type i.e. ast::AstNodeType::UNIT_BLOCK
14050  *
14051  * \sa Ast::get_node_type_name
14052  */
14053  AstNodeType get_node_type() const noexcept override {
14054  return AstNodeType::UNIT_BLOCK;
14055  }
14056 
14057  /**
14058  * \brief Return type (ast::AstNodeType) of ast node as std::string
14059  *
14060  * Every node in the ast has a type defined in ast::AstNodeType.
14061  * This type name can be returned as a std::string for printing
14062  * node to text/json form.
14063  *
14064  * \return name of the node type as a string i.e. "UnitBlock"
14065  *
14066  * \sa Ast::get_node_name
14067  */
14068  std::string get_node_type_name() const noexcept override {
14069  return "UnitBlock";
14070  }
14071 
14072  /**
14073  * \brief Return NMODL statement of ast node as std::string
14074  *
14075  * Every node is related to a special statement in the NMODL. This
14076  * statement can be returned as a std::string for printing to
14077  * text/json form.
14078  *
14079  * \return name of the statement as a string i.e. "UNITS "
14080  *
14081  * \sa Ast::get_nmodl_name
14082  */
14083  std::string get_nmodl_name() const noexcept override { return "UNITS "; }
14084 
14085  /**
14086  * \brief Get std::shared_ptr from `this` pointer of the current ast node
14087  */
14088  std::shared_ptr<Ast> get_shared_ptr() override {
14089  return std::static_pointer_cast<UnitBlock>(shared_from_this());
14090  }
14091 
14092  /**
14093  * \brief Get std::shared_ptr from `this` pointer of the current ast node
14094  */
14095  std::shared_ptr<const Ast> get_shared_ptr() const override {
14096  return std::static_pointer_cast<const UnitBlock>(shared_from_this());
14097  }
14098 
14099  /**
14100  * \brief Return associated token for the current ast node
14101  *
14102  * Not all ast nodes have token information. For example,
14103  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
14104  * solution of ODEs. In this case, we return nullptr to store in the
14105  * nmodl::symtab::SymbolTable.
14106  *
14107  * \return pointer to token if exist otherwise nullptr
14108  */
14109  const ModToken *get_token() const noexcept override { return token.get(); }
14110 
14111  /**
14112  * \brief Return associated symbol table for the current ast node
14113  *
14114  * Only certain ast nodes (e.g. inherited from ast::Block) have associated
14115  * symbol table. These nodes have nmodl::symtab::SymbolTable as member
14116  * and it can be accessed using this method.
14117  *
14118  * \return pointer to the symbol table
14119  *
14120  * \sa nmodl::symtab::SymbolTable nmodl::visitor::SymtabVisitor
14121  */
14122  symtab::SymbolTable *get_symbol_table() const override { return symtab; }
14123 
14124  /**
14125  * \brief Getter for member variable \ref UnitBlock.definitions
14126  */
14127  const ExpressionVector &get_definitions() const noexcept {
14128  return definitions;
14129  }
14130 
14131  /// \}
14132 
14133  /// \name Setters
14134  /// \{
14135 
14136  /**
14137  * \brief Set token for the current ast node
14138  */
14139  void set_token(const ModToken &tok) {
14140  token = std::make_shared<ModToken>(tok);
14141  }
14142 
14143  /**
14144  * \brief Set symbol table for the current ast node
14145  *
14146  * Top level, block scoped nodes store symbol table in the ast node.
14147  * nmodl::visitor::SymtabVisitor then used this method to setup symbol table
14148  * for every node in the ast.
14149  *
14150  * \sa nmodl::visitor::SymtabVisitor
14151  */
14152  void set_symbol_table(symtab::SymbolTable *newsymtab) override {
14153  symtab = newsymtab;
14154  }
14155 
14156  /**
14157  * \brief Setter for member variable \ref UnitBlock.definitions (rvalue
14158  * reference)
14159  */
14160  void set_definitions(ExpressionVector &&definitions);
14161 
14162  /**
14163  * \brief Setter for member variable \ref UnitBlock.definitions
14164  */
14165  void set_definitions(const ExpressionVector &definitions);
14166 
14167  /// \}
14168 
14169  /// \name Visitor
14170  /// \{
14171 
14172  /**
14173  * \brief visit children i.e. member variables of current node using provided
14174  * visitor
14175  *
14176  * Different nodes in the AST have different members (i.e. children). This
14177  * method recursively visits children using provided visitor.
14178  *
14179  * \param v Concrete visitor that will be used to recursively visit children
14180  *
14181  * \sa Ast::visit_children for example.
14182  */
14183  void visit_children(visitor::Visitor &v) override;
14184 
14185  /**
14186  * \brief visit children i.e. member variables of current node using provided
14187  * visitor
14188  *
14189  * Different nodes in the AST have different members (i.e. children). This
14190  * method recursively visits children using provided visitor.
14191  *
14192  * \param v Concrete constant visitor that will be used to recursively visit
14193  * children
14194  *
14195  * \sa Ast::visit_children for example.
14196  */
14197  void visit_children(visitor::ConstVisitor &v) const override;
14198 
14199  /**
14200  * \brief accept (or visit) the current AST node using provided visitor
14201  *
14202  * Instead of visiting children of AST node, like Ast::visit_children,
14203  * accept allows to visit the current node itself using provided concrete
14204  * visitor.
14205  *
14206  * \param v Concrete visitor that will be used to recursively visit node
14207  *
14208  * \sa Ast::accept for example.
14209  */
14210  void accept(visitor::Visitor &v) override;
14211 
14212  /**
14213  * \copydoc accept(visitor::Visitor&)
14214  */
14215  void accept(visitor::ConstVisitor &v) const override;
14216 
14217  /// \}
14218 
14219 private:
14220  /**
14221  * \brief Set this object as parent for all the children
14222  *
14223  * This should be called in every object (with children) constructor
14224  * to set parents. Since it is called only in the constructors it
14225  * should not be virtual to avoid ambiguities (issue #295).
14226  */
14227  void set_parent_in_children();
14228 };
14229 
14230 /** @} */ // end of ast_class
14231 
14232 } // namespace ast
14233 } // namespace nmodl
14234 #endif // !NMODL_AST_UNIT_BLOCK_HPP
14235 #ifndef NMODL_AST_CONSTANT_BLOCK_HPP
14236 #define NMODL_AST_CONSTANT_BLOCK_HPP
14237 
14238 namespace nmodl {
14239 namespace ast {
14240 
14241 /**
14242  * @addtogroup ast_class
14243  * @ingroup ast
14244  * @{
14245  */
14246 
14247 /**
14248  * \brief Represent `CONSTANT` block in the mod file
14249  *
14250  * Here is an example of `CONSTANT` block in mod file:
14251  *
14252  * \code{.mod}
14253  * CONSTANT {
14254  * q10 = 3
14255  *
14256  * cvm = 28.9 (mV)
14257  * ckm = 6.2 (mV)
14258  * ctm = 0.000505 (s)
14259  * }
14260  * \endcode
14261  *
14262  */
14263 class ConstantBlock : public Block {
14264 private:
14265  /// Vector of constant statements
14267  /// token with location information
14268  std::shared_ptr<ModToken> token;
14269  /// symbol table for a block
14270  symtab::SymbolTable *symtab = nullptr;
14271 
14272 public:
14273  /// \name Ctor & dtor
14274  /// \{
14275 
14276  explicit ConstantBlock(ConstantStatementVector statements);
14277  ConstantBlock(const ConstantBlock &obj);
14278 
14279  virtual ~ConstantBlock() = default;
14280 
14281  /// \}
14282 
14283  /**
14284  * \brief Check if the ast node is an instance of ast::ConstantBlock
14285  * \return true as object is of type ast::ConstantBlock
14286  */
14287  bool is_constant_block() const noexcept override { return true; }
14288 
14289  /**
14290  * \brief Return a copy of the current node
14291  *
14292  * Recursively make a new copy/clone of the current node including
14293  * all members and return a pointer to the node. This is used for
14294  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
14295  * ast.
14296  *
14297  * @return pointer to the clone/copy of the current node
14298  */
14299  ConstantBlock *clone() const override { return new ConstantBlock(*this); }
14300 
14301  /// \name Getters
14302  /// \{
14303 
14304  /**
14305  * \brief Return type (ast::AstNodeType) of ast node
14306  *
14307  * Every node in the ast has a type defined in ast::AstNodeType and this
14308  * function is used to retrieve the same.
14309  *
14310  * \return ast node type i.e. ast::AstNodeType::CONSTANT_BLOCK
14311  *
14312  * \sa Ast::get_node_type_name
14313  */
14314  AstNodeType get_node_type() const noexcept override {
14316  }
14317 
14318  /**
14319  * \brief Return type (ast::AstNodeType) of ast node as std::string
14320  *
14321  * Every node in the ast has a type defined in ast::AstNodeType.
14322  * This type name can be returned as a std::string for printing
14323  * node to text/json form.
14324  *
14325  * \return name of the node type as a string i.e. "ConstantBlock"
14326  *
14327  * \sa Ast::get_node_name
14328  */
14329  std::string get_node_type_name() const noexcept override {
14330  return "ConstantBlock";
14331  }
14332 
14333  /**
14334  * \brief Return NMODL statement of ast node as std::string
14335  *
14336  * Every node is related to a special statement in the NMODL. This
14337  * statement can be returned as a std::string for printing to
14338  * text/json form.
14339  *
14340  * \return name of the statement as a string i.e. "CONSTANT "
14341  *
14342  * \sa Ast::get_nmodl_name
14343  */
14344  std::string get_nmodl_name() const noexcept override { return "CONSTANT "; }
14345 
14346  /**
14347  * \brief Get std::shared_ptr from `this` pointer of the current ast node
14348  */
14349  std::shared_ptr<Ast> get_shared_ptr() override {
14350  return std::static_pointer_cast<ConstantBlock>(shared_from_this());
14351  }
14352 
14353  /**
14354  * \brief Get std::shared_ptr from `this` pointer of the current ast node
14355  */
14356  std::shared_ptr<const Ast> get_shared_ptr() const override {
14357  return std::static_pointer_cast<const ConstantBlock>(shared_from_this());
14358  }
14359 
14360  /**
14361  * \brief Return associated token for the current ast node
14362  *
14363  * Not all ast nodes have token information. For example,
14364  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
14365  * solution of ODEs. In this case, we return nullptr to store in the
14366  * nmodl::symtab::SymbolTable.
14367  *
14368  * \return pointer to token if exist otherwise nullptr
14369  */
14370  const ModToken *get_token() const noexcept override { return token.get(); }
14371 
14372  /**
14373  * \brief Return associated symbol table for the current ast node
14374  *
14375  * Only certain ast nodes (e.g. inherited from ast::Block) have associated
14376  * symbol table. These nodes have nmodl::symtab::SymbolTable as member
14377  * and it can be accessed using this method.
14378  *
14379  * \return pointer to the symbol table
14380  *
14381  * \sa nmodl::symtab::SymbolTable nmodl::visitor::SymtabVisitor
14382  */
14383  symtab::SymbolTable *get_symbol_table() const override { return symtab; }
14384 
14385  /**
14386  * \brief Getter for member variable \ref ConstantBlock.statements
14387  */
14388  const ConstantStatementVector &get_statements() const noexcept {
14389  return statements;
14390  }
14391 
14392  /// \}
14393 
14394  /// \name Setters
14395  /// \{
14396 
14397  /**
14398  * \brief Set token for the current ast node
14399  */
14400  void set_token(const ModToken &tok) {
14401  token = std::make_shared<ModToken>(tok);
14402  }
14403 
14404  /**
14405  * \brief Set symbol table for the current ast node
14406  *
14407  * Top level, block scoped nodes store symbol table in the ast node.
14408  * nmodl::visitor::SymtabVisitor then used this method to setup symbol table
14409  * for every node in the ast.
14410  *
14411  * \sa nmodl::visitor::SymtabVisitor
14412  */
14413  void set_symbol_table(symtab::SymbolTable *newsymtab) override {
14414  symtab = newsymtab;
14415  }
14416 
14417  /**
14418  * \brief Setter for member variable \ref ConstantBlock.statements (rvalue
14419  * reference)
14420  */
14421  void set_statements(ConstantStatementVector &&statements);
14422 
14423  /**
14424  * \brief Setter for member variable \ref ConstantBlock.statements
14425  */
14426  void set_statements(const ConstantStatementVector &statements);
14427 
14428  /// \}
14429 
14430  /// \name Visitor
14431  /// \{
14432 
14433  /**
14434  * \brief visit children i.e. member variables of current node using provided
14435  * visitor
14436  *
14437  * Different nodes in the AST have different members (i.e. children). This
14438  * method recursively visits children using provided visitor.
14439  *
14440  * \param v Concrete visitor that will be used to recursively visit children
14441  *
14442  * \sa Ast::visit_children for example.
14443  */
14444  void visit_children(visitor::Visitor &v) override;
14445 
14446  /**
14447  * \brief visit children i.e. member variables of current node using provided
14448  * visitor
14449  *
14450  * Different nodes in the AST have different members (i.e. children). This
14451  * method recursively visits children using provided visitor.
14452  *
14453  * \param v Concrete constant visitor that will be used to recursively visit
14454  * children
14455  *
14456  * \sa Ast::visit_children for example.
14457  */
14458  void visit_children(visitor::ConstVisitor &v) const override;
14459 
14460  /**
14461  * \brief accept (or visit) the current AST node using provided visitor
14462  *
14463  * Instead of visiting children of AST node, like Ast::visit_children,
14464  * accept allows to visit the current node itself using provided concrete
14465  * visitor.
14466  *
14467  * \param v Concrete visitor that will be used to recursively visit node
14468  *
14469  * \sa Ast::accept for example.
14470  */
14471  void accept(visitor::Visitor &v) override;
14472 
14473  /**
14474  * \copydoc accept(visitor::Visitor&)
14475  */
14476  void accept(visitor::ConstVisitor &v) const override;
14477 
14478  /// \}
14479 
14480 private:
14481  /**
14482  * \brief Set this object as parent for all the children
14483  *
14484  * This should be called in every object (with children) constructor
14485  * to set parents. Since it is called only in the constructors it
14486  * should not be virtual to avoid ambiguities (issue #295).
14487  */
14488  void set_parent_in_children();
14489 };
14490 
14491 /** @} */ // end of ast_class
14492 
14493 } // namespace ast
14494 } // namespace nmodl
14495 #endif // !NMODL_AST_CONSTANT_BLOCK_HPP
14496 #ifndef NMODL_AST_NEURON_BLOCK_HPP
14497 #define NMODL_AST_NEURON_BLOCK_HPP
14498 
14499 namespace nmodl {
14500 namespace ast {
14501 
14502 /**
14503  * @addtogroup ast_class
14504  * @ingroup ast
14505  * @{
14506  */
14507 
14508 /**
14509  * \brief Represent `NEURON` block in the mod file
14510  *
14511  * The keyword `NEURON` introduces a special block which contains statements
14512  * that tell NMODL how to organize the variables for access at the NEURON user
14513  * level. Here is an example of `NEURON` block from `HH` channel:
14514  *
14515  * \code{.mod}
14516  * NEURON {
14517  * SUFFIX hh
14518  * USEION na READ ena WRITE ina
14519  * USEION k READ ek WRITE ik
14520  * NONSPECIFIC_CURRENT il
14521  * RANGE gnabar, gkbar, gl, el, gna, gk
14522  * RANGE minf, hinf, ninf, mtau, htau, ntau
14523  * THREADSAFE
14524  * }
14525  * \endcode
14526  *
14527  */
14528 class NeuronBlock : public Block {
14529 private:
14530  /// Block with statements vector
14531  std::shared_ptr<StatementBlock> statement_block;
14532  /// token with location information
14533  std::shared_ptr<ModToken> token;
14534  /// symbol table for a block
14535  symtab::SymbolTable *symtab = nullptr;
14536 
14537 public:
14538  /// \name Ctor & dtor
14539  /// \{
14540 
14541  explicit NeuronBlock(StatementBlock *statement_block);
14542  explicit NeuronBlock(const std::shared_ptr<StatementBlock> &statement_block);
14543  NeuronBlock(const NeuronBlock &obj);
14544 
14545  virtual ~NeuronBlock() = default;
14546 
14547  /// \}
14548 
14549  /**
14550  * \brief Check if the ast node is an instance of ast::NeuronBlock
14551  * \return true as object is of type ast::NeuronBlock
14552  */
14553  bool is_neuron_block() const noexcept override { return true; }
14554 
14555  /**
14556  * \brief Return a copy of the current node
14557  *
14558  * Recursively make a new copy/clone of the current node including
14559  * all members and return a pointer to the node. This is used for
14560  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
14561  * ast.
14562  *
14563  * @return pointer to the clone/copy of the current node
14564  */
14565  NeuronBlock *clone() const override { return new NeuronBlock(*this); }
14566 
14567  /// \name Getters
14568  /// \{
14569 
14570  /**
14571  * \brief Return type (ast::AstNodeType) of ast node
14572  *
14573  * Every node in the ast has a type defined in ast::AstNodeType and this
14574  * function is used to retrieve the same.
14575  *
14576  * \return ast node type i.e. ast::AstNodeType::NEURON_BLOCK
14577  *
14578  * \sa Ast::get_node_type_name
14579  */
14580  AstNodeType get_node_type() const noexcept override {
14582  }
14583 
14584  /**
14585  * \brief Return type (ast::AstNodeType) of ast node as std::string
14586  *
14587  * Every node in the ast has a type defined in ast::AstNodeType.
14588  * This type name can be returned as a std::string for printing
14589  * node to text/json form.
14590  *
14591  * \return name of the node type as a string i.e. "NeuronBlock"
14592  *
14593  * \sa Ast::get_node_name
14594  */
14595  std::string get_node_type_name() const noexcept override {
14596  return "NeuronBlock";
14597  }
14598 
14599  /**
14600  * \brief Return NMODL statement of ast node as std::string
14601  *
14602  * Every node is related to a special statement in the NMODL. This
14603  * statement can be returned as a std::string for printing to
14604  * text/json form.
14605  *
14606  * \return name of the statement as a string i.e. "NEURON "
14607  *
14608  * \sa Ast::get_nmodl_name
14609  */
14610  std::string get_nmodl_name() const noexcept override { return "NEURON "; }
14611 
14612  /**
14613  * \brief Get std::shared_ptr from `this` pointer of the current ast node
14614  */
14615  std::shared_ptr<Ast> get_shared_ptr() override {
14616  return std::static_pointer_cast<NeuronBlock>(shared_from_this());
14617  }
14618 
14619  /**
14620  * \brief Get std::shared_ptr from `this` pointer of the current ast node
14621  */
14622  std::shared_ptr<const Ast> get_shared_ptr() const override {
14623  return std::static_pointer_cast<const NeuronBlock>(shared_from_this());
14624  }
14625 
14626  /**
14627  * \brief Return associated token for the current ast node
14628  *
14629  * Not all ast nodes have token information. For example,
14630  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
14631  * solution of ODEs. In this case, we return nullptr to store in the
14632  * nmodl::symtab::SymbolTable.
14633  *
14634  * \return pointer to token if exist otherwise nullptr
14635  */
14636  const ModToken *get_token() const noexcept override { return token.get(); }
14637 
14638  /**
14639  * \brief Return associated symbol table for the current ast node
14640  *
14641  * Only certain ast nodes (e.g. inherited from ast::Block) have associated
14642  * symbol table. These nodes have nmodl::symtab::SymbolTable as member
14643  * and it can be accessed using this method.
14644  *
14645  * \return pointer to the symbol table
14646  *
14647  * \sa nmodl::symtab::SymbolTable nmodl::visitor::SymtabVisitor
14648  */
14649  symtab::SymbolTable *get_symbol_table() const override { return symtab; }
14650 
14651  /**
14652  * \brief Getter for member variable \ref NeuronBlock.statement_block
14653  */
14654  const std::shared_ptr<StatementBlock> &get_statement_block() const
14655  noexcept override {
14656  return statement_block;
14657  }
14658 
14659  /// \}
14660 
14661  /// \name Setters
14662  /// \{
14663 
14664  /**
14665  * \brief Set token for the current ast node
14666  */
14667  void set_token(const ModToken &tok) {
14668  token = std::make_shared<ModToken>(tok);
14669  }
14670 
14671  /**
14672  * \brief Set symbol table for the current ast node
14673  *
14674  * Top level, block scoped nodes store symbol table in the ast node.
14675  * nmodl::visitor::SymtabVisitor then used this method to setup symbol table
14676  * for every node in the ast.
14677  *
14678  * \sa nmodl::visitor::SymtabVisitor
14679  */
14680  void set_symbol_table(symtab::SymbolTable *newsymtab) override {
14681  symtab = newsymtab;
14682  }
14683 
14684  /**
14685  * \brief Setter for member variable \ref NeuronBlock.statement_block (rvalue
14686  * reference)
14687  */
14688  void set_statement_block(std::shared_ptr<StatementBlock> &&statement_block);
14689 
14690  /**
14691  * \brief Setter for member variable \ref NeuronBlock.statement_block
14692  */
14693  void
14694  set_statement_block(const std::shared_ptr<StatementBlock> &statement_block);
14695 
14696  /// \}
14697 
14698  /// \name Visitor
14699  /// \{
14700 
14701  /**
14702  * \brief visit children i.e. member variables of current node using provided
14703  * visitor
14704  *
14705  * Different nodes in the AST have different members (i.e. children). This
14706  * method recursively visits children using provided visitor.
14707  *
14708  * \param v Concrete visitor that will be used to recursively visit children
14709  *
14710  * \sa Ast::visit_children for example.
14711  */
14712  void visit_children(visitor::Visitor &v) override;
14713 
14714  /**
14715  * \brief visit children i.e. member variables of current node using provided
14716  * visitor
14717  *
14718  * Different nodes in the AST have different members (i.e. children). This
14719  * method recursively visits children using provided visitor.
14720  *
14721  * \param v Concrete constant visitor that will be used to recursively visit
14722  * children
14723  *
14724  * \sa Ast::visit_children for example.
14725  */
14726  void visit_children(visitor::ConstVisitor &v) const override;
14727 
14728  /**
14729  * \brief accept (or visit) the current AST node using provided visitor
14730  *
14731  * Instead of visiting children of AST node, like Ast::visit_children,
14732  * accept allows to visit the current node itself using provided concrete
14733  * visitor.
14734  *
14735  * \param v Concrete visitor that will be used to recursively visit node
14736  *
14737  * \sa Ast::accept for example.
14738  */
14739  void accept(visitor::Visitor &v) override;
14740 
14741  /**
14742  * \copydoc accept(visitor::Visitor&)
14743  */
14744  void accept(visitor::ConstVisitor &v) const override;
14745 
14746  /// \}
14747 
14748 private:
14749  /**
14750  * \brief Set this object as parent for all the children
14751  *
14752  * This should be called in every object (with children) constructor
14753  * to set parents. Since it is called only in the constructors it
14754  * should not be virtual to avoid ambiguities (issue #295).
14755  */
14756  void set_parent_in_children();
14757 };
14758 
14759 /** @} */ // end of ast_class
14760 
14761 } // namespace ast
14762 } // namespace nmodl
14763 #endif // !NMODL_AST_NEURON_BLOCK_HPP
14764 #ifndef NMODL_AST_UNIT_HPP
14765 #define NMODL_AST_UNIT_HPP
14766 
14767 namespace nmodl {
14768 namespace ast {
14769 
14770 /**
14771  * @addtogroup ast_class
14772  * @ingroup ast
14773  * @{
14774  */
14775 
14776 /**
14777  * \brief TODO
14778  *
14779  *
14780  */
14781 class Unit : public Expression {
14782 private:
14783  /// TODO
14784  std::shared_ptr<String> name;
14785  /// token with location information
14786  std::shared_ptr<ModToken> token;
14787 
14788 public:
14789  /// \name Ctor & dtor
14790  /// \{
14791 
14792  explicit Unit(String *name);
14793  explicit Unit(const std::shared_ptr<String> &name);
14794  Unit(const Unit &obj);
14795 
14796  virtual ~Unit() = default;
14797 
14798  /// \}
14799 
14800  /**
14801  * \brief Check if the ast node is an instance of ast::Unit
14802  * \return true as object is of type ast::Unit
14803  */
14804  bool is_unit() const noexcept override { return true; }
14805 
14806  /**
14807  * \brief Return a copy of the current node
14808  *
14809  * Recursively make a new copy/clone of the current node including
14810  * all members and return a pointer to the node. This is used for
14811  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
14812  * ast.
14813  *
14814  * @return pointer to the clone/copy of the current node
14815  */
14816  Unit *clone() const override { return new Unit(*this); }
14817 
14818  /// \name Getters
14819  /// \{
14820 
14821  /**
14822  * \brief Return type (ast::AstNodeType) of ast node
14823  *
14824  * Every node in the ast has a type defined in ast::AstNodeType and this
14825  * function is used to retrieve the same.
14826  *
14827  * \return ast node type i.e. ast::AstNodeType::UNIT
14828  *
14829  * \sa Ast::get_node_type_name
14830  */
14831  AstNodeType get_node_type() const noexcept override {
14832  return AstNodeType::UNIT;
14833  }
14834 
14835  /**
14836  * \brief Return type (ast::AstNodeType) of ast node as std::string
14837  *
14838  * Every node in the ast has a type defined in ast::AstNodeType.
14839  * This type name can be returned as a std::string for printing
14840  * node to text/json form.
14841  *
14842  * \return name of the node type as a string i.e. "Unit"
14843  *
14844  * \sa Ast::get_node_name
14845  */
14846  std::string get_node_type_name() const noexcept override { return "Unit"; }
14847 
14848  /**
14849  * \brief Get std::shared_ptr from `this` pointer of the current ast node
14850  */
14851  std::shared_ptr<Ast> get_shared_ptr() override {
14852  return std::static_pointer_cast<Unit>(shared_from_this());
14853  }
14854 
14855  /**
14856  * \brief Get std::shared_ptr from `this` pointer of the current ast node
14857  */
14858  std::shared_ptr<const Ast> get_shared_ptr() const override {
14859  return std::static_pointer_cast<const Unit>(shared_from_this());
14860  }
14861 
14862  /**
14863  * \brief Return associated token for the current ast node
14864  *
14865  * Not all ast nodes have token information. For example,
14866  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
14867  * solution of ODEs. In this case, we return nullptr to store in the
14868  * nmodl::symtab::SymbolTable.
14869  *
14870  * \return pointer to token if exist otherwise nullptr
14871  */
14872  const ModToken *get_token() const noexcept override { return token.get(); }
14873 
14874  /**
14875  * \brief Return name of the node
14876  *
14877  * Some ast nodes have a member marked designated as node name. For example,
14878  * in case of this ast::String has name designated as a
14879  * node name.
14880  *
14881  * @return name of the node as std::string
14882  *
14883  * \sa Ast::get_node_type_name
14884  */
14885  std::string get_node_name() const override;
14886 
14887  /**
14888  * \brief Getter for member variable \ref Unit.name
14889  */
14890  const std::shared_ptr<String> &get_name() const noexcept { return name; }
14891 
14892  /// \}
14893 
14894  /// \name Setters
14895  /// \{
14896 
14897  /**
14898  * \brief Set token for the current ast node
14899  */
14900  void set_token(const ModToken &tok) {
14901  token = std::make_shared<ModToken>(tok);
14902  }
14903 
14904  /**
14905  * \brief Setter for member variable \ref Unit.name (rvalue reference)
14906  */
14907  void set_name(std::shared_ptr<String> &&name);
14908 
14909  /**
14910  * \brief Setter for member variable \ref Unit.name
14911  */
14912  void set_name(const std::shared_ptr<String> &name);
14913 
14914  /// \}
14915 
14916  /// \name Visitor
14917  /// \{
14918 
14919  /**
14920  * \brief visit children i.e. member variables of current node using provided
14921  * visitor
14922  *
14923  * Different nodes in the AST have different members (i.e. children). This
14924  * method recursively visits children using provided visitor.
14925  *
14926  * \param v Concrete visitor that will be used to recursively visit children
14927  *
14928  * \sa Ast::visit_children for example.
14929  */
14930  void visit_children(visitor::Visitor &v) override;
14931 
14932  /**
14933  * \brief visit children i.e. member variables of current node using provided
14934  * visitor
14935  *
14936  * Different nodes in the AST have different members (i.e. children). This
14937  * method recursively visits children using provided visitor.
14938  *
14939  * \param v Concrete constant visitor that will be used to recursively visit
14940  * children
14941  *
14942  * \sa Ast::visit_children for example.
14943  */
14944  void visit_children(visitor::ConstVisitor &v) const override;
14945 
14946  /**
14947  * \brief accept (or visit) the current AST node using provided visitor
14948  *
14949  * Instead of visiting children of AST node, like Ast::visit_children,
14950  * accept allows to visit the current node itself using provided concrete
14951  * visitor.
14952  *
14953  * \param v Concrete visitor that will be used to recursively visit node
14954  *
14955  * \sa Ast::accept for example.
14956  */
14957  void accept(visitor::Visitor &v) override;
14958 
14959  /**
14960  * \copydoc accept(visitor::Visitor&)
14961  */
14962  void accept(visitor::ConstVisitor &v) const override;
14963 
14964  /// \}
14965 
14966 private:
14967  /**
14968  * \brief Set this object as parent for all the children
14969  *
14970  * This should be called in every object (with children) constructor
14971  * to set parents. Since it is called only in the constructors it
14972  * should not be virtual to avoid ambiguities (issue #295).
14973  */
14974  void set_parent_in_children();
14975 };
14976 
14977 /** @} */ // end of ast_class
14978 
14979 } // namespace ast
14980 } // namespace nmodl
14981 #endif // !NMODL_AST_UNIT_HPP
14982 #ifndef NMODL_AST_DOUBLE_UNIT_HPP
14983 #define NMODL_AST_DOUBLE_UNIT_HPP
14984 
14985 namespace nmodl {
14986 namespace ast {
14987 
14988 /**
14989  * @addtogroup ast_class
14990  * @ingroup ast
14991  * @{
14992  */
14993 
14994 /**
14995  * \brief TODO
14996  *
14997  *
14998  */
14999 class DoubleUnit : public Expression {
15000 private:
15001  /// TODO
15002  std::shared_ptr<Double> value;
15003  /// TODO
15004  std::shared_ptr<Unit> unit;
15005  /// token with location information
15006  std::shared_ptr<ModToken> token;
15007 
15008 public:
15009  /// \name Ctor & dtor
15010  /// \{
15011 
15012  explicit DoubleUnit(Double *value, Unit *unit);
15013  explicit DoubleUnit(const std::shared_ptr<Double> &value,
15014  const std::shared_ptr<Unit> &unit);
15015  DoubleUnit(const DoubleUnit &obj);
15016 
15017  virtual ~DoubleUnit() = default;
15018 
15019  /// \}
15020 
15021  /**
15022  * \brief Check if the ast node is an instance of ast::DoubleUnit
15023  * \return true as object is of type ast::DoubleUnit
15024  */
15025  bool is_double_unit() const noexcept override { return true; }
15026 
15027  /**
15028  * \brief Return a copy of the current node
15029  *
15030  * Recursively make a new copy/clone of the current node including
15031  * all members and return a pointer to the node. This is used for
15032  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
15033  * ast.
15034  *
15035  * @return pointer to the clone/copy of the current node
15036  */
15037  DoubleUnit *clone() const override { return new DoubleUnit(*this); }
15038 
15039  /// \name Getters
15040  /// \{
15041 
15042  /**
15043  * \brief Return type (ast::AstNodeType) of ast node
15044  *
15045  * Every node in the ast has a type defined in ast::AstNodeType and this
15046  * function is used to retrieve the same.
15047  *
15048  * \return ast node type i.e. ast::AstNodeType::DOUBLE_UNIT
15049  *
15050  * \sa Ast::get_node_type_name
15051  */
15052  AstNodeType get_node_type() const noexcept override {
15053  return AstNodeType::DOUBLE_UNIT;
15054  }
15055 
15056  /**
15057  * \brief Return type (ast::AstNodeType) of ast node as std::string
15058  *
15059  * Every node in the ast has a type defined in ast::AstNodeType.
15060  * This type name can be returned as a std::string for printing
15061  * node to text/json form.
15062  *
15063  * \return name of the node type as a string i.e. "DoubleUnit"
15064  *
15065  * \sa Ast::get_node_name
15066  */
15067  std::string get_node_type_name() const noexcept override {
15068  return "DoubleUnit";
15069  }
15070 
15071  /**
15072  * \brief Get std::shared_ptr from `this` pointer of the current ast node
15073  */
15074  std::shared_ptr<Ast> get_shared_ptr() override {
15075  return std::static_pointer_cast<DoubleUnit>(shared_from_this());
15076  }
15077 
15078  /**
15079  * \brief Get std::shared_ptr from `this` pointer of the current ast node
15080  */
15081  std::shared_ptr<const Ast> get_shared_ptr() const override {
15082  return std::static_pointer_cast<const DoubleUnit>(shared_from_this());
15083  }
15084 
15085  /**
15086  * \brief Return associated token for the current ast node
15087  *
15088  * Not all ast nodes have token information. For example,
15089  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
15090  * solution of ODEs. In this case, we return nullptr to store in the
15091  * nmodl::symtab::SymbolTable.
15092  *
15093  * \return pointer to token if exist otherwise nullptr
15094  */
15095  const ModToken *get_token() const noexcept override { return token.get(); }
15096 
15097  /**
15098  * \brief Getter for member variable \ref DoubleUnit.value
15099  */
15100  const std::shared_ptr<Double> &get_value() const noexcept { return value; }
15101 
15102  /**
15103  * \brief Getter for member variable \ref DoubleUnit.unit
15104  */
15105  const std::shared_ptr<Unit> &get_unit() const noexcept { return unit; }
15106 
15107  /// \}
15108 
15109  /// \name Setters
15110  /// \{
15111 
15112  /**
15113  * \brief Set token for the current ast node
15114  */
15115  void set_token(const ModToken &tok) {
15116  token = std::make_shared<ModToken>(tok);
15117  }
15118 
15119  /**
15120  * \brief Setter for member variable \ref DoubleUnit.value (rvalue reference)
15121  */
15122  void set_value(std::shared_ptr<Double> &&value);
15123 
15124  /**
15125  * \brief Setter for member variable \ref DoubleUnit.value
15126  */
15127  void set_value(const std::shared_ptr<Double> &value);
15128 
15129  /**
15130  * \brief Setter for member variable \ref DoubleUnit.unit (rvalue reference)
15131  */
15132  void set_unit(std::shared_ptr<Unit> &&unit);
15133 
15134  /**
15135  * \brief Setter for member variable \ref DoubleUnit.unit
15136  */
15137  void set_unit(const std::shared_ptr<Unit> &unit);
15138 
15139  /// \}
15140 
15141  /// \name Visitor
15142  /// \{
15143 
15144  /**
15145  * \brief visit children i.e. member variables of current node using provided
15146  * visitor
15147  *
15148  * Different nodes in the AST have different members (i.e. children). This
15149  * method recursively visits children using provided visitor.
15150  *
15151  * \param v Concrete visitor that will be used to recursively visit children
15152  *
15153  * \sa Ast::visit_children for example.
15154  */
15155  void visit_children(visitor::Visitor &v) override;
15156 
15157  /**
15158  * \brief visit children i.e. member variables of current node using provided
15159  * visitor
15160  *
15161  * Different nodes in the AST have different members (i.e. children). This
15162  * method recursively visits children using provided visitor.
15163  *
15164  * \param v Concrete constant visitor that will be used to recursively visit
15165  * children
15166  *
15167  * \sa Ast::visit_children for example.
15168  */
15169  void visit_children(visitor::ConstVisitor &v) const override;
15170 
15171  /**
15172  * \brief accept (or visit) the current AST node using provided visitor
15173  *
15174  * Instead of visiting children of AST node, like Ast::visit_children,
15175  * accept allows to visit the current node itself using provided concrete
15176  * visitor.
15177  *
15178  * \param v Concrete visitor that will be used to recursively visit node
15179  *
15180  * \sa Ast::accept for example.
15181  */
15182  void accept(visitor::Visitor &v) override;
15183 
15184  /**
15185  * \copydoc accept(visitor::Visitor&)
15186  */
15187  void accept(visitor::ConstVisitor &v) const override;
15188 
15189  /// \}
15190 
15191 private:
15192  /**
15193  * \brief Set this object as parent for all the children
15194  *
15195  * This should be called in every object (with children) constructor
15196  * to set parents. Since it is called only in the constructors it
15197  * should not be virtual to avoid ambiguities (issue #295).
15198  */
15199  void set_parent_in_children();
15200 };
15201 
15202 /** @} */ // end of ast_class
15203 
15204 } // namespace ast
15205 } // namespace nmodl
15206 #endif // !NMODL_AST_DOUBLE_UNIT_HPP
15207 #ifndef NMODL_AST_LOCAL_VAR_HPP
15208 #define NMODL_AST_LOCAL_VAR_HPP
15209 
15210 namespace nmodl {
15211 namespace ast {
15212 
15213 /**
15214  * @addtogroup ast_class
15215  * @ingroup ast
15216  * @{
15217  */
15218 
15219 /**
15220  * \brief TODO
15221  *
15222  *
15223  */
15224 class LocalVar : public Expression {
15225 private:
15226  /// TODO
15227  std::shared_ptr<Identifier> name;
15228  /// token with location information
15229  std::shared_ptr<ModToken> token;
15230 
15231 public:
15232  /// \name Ctor & dtor
15233  /// \{
15234 
15235  explicit LocalVar(Identifier *name);
15236  explicit LocalVar(const std::shared_ptr<Identifier> &name);
15237  LocalVar(const LocalVar &obj);
15238 
15239  virtual ~LocalVar() = default;
15240 
15241  /// \}
15242 
15243  /**
15244  * \brief Check if the ast node is an instance of ast::LocalVar
15245  * \return true as object is of type ast::LocalVar
15246  */
15247  bool is_local_var() const noexcept override { return true; }
15248 
15249  /**
15250  * \brief Return a copy of the current node
15251  *
15252  * Recursively make a new copy/clone of the current node including
15253  * all members and return a pointer to the node. This is used for
15254  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
15255  * ast.
15256  *
15257  * @return pointer to the clone/copy of the current node
15258  */
15259  LocalVar *clone() const override { return new LocalVar(*this); }
15260 
15261  /// \name Getters
15262  /// \{
15263 
15264  /**
15265  * \brief Return type (ast::AstNodeType) of ast node
15266  *
15267  * Every node in the ast has a type defined in ast::AstNodeType and this
15268  * function is used to retrieve the same.
15269  *
15270  * \return ast node type i.e. ast::AstNodeType::LOCAL_VAR
15271  *
15272  * \sa Ast::get_node_type_name
15273  */
15274  AstNodeType get_node_type() const noexcept override {
15275  return AstNodeType::LOCAL_VAR;
15276  }
15277 
15278  /**
15279  * \brief Return type (ast::AstNodeType) of ast node as std::string
15280  *
15281  * Every node in the ast has a type defined in ast::AstNodeType.
15282  * This type name can be returned as a std::string for printing
15283  * node to text/json form.
15284  *
15285  * \return name of the node type as a string i.e. "LocalVar"
15286  *
15287  * \sa Ast::get_node_name
15288  */
15289  std::string get_node_type_name() const noexcept override {
15290  return "LocalVar";
15291  }
15292 
15293  /**
15294  * \brief Get std::shared_ptr from `this` pointer of the current ast node
15295  */
15296  std::shared_ptr<Ast> get_shared_ptr() override {
15297  return std::static_pointer_cast<LocalVar>(shared_from_this());
15298  }
15299 
15300  /**
15301  * \brief Get std::shared_ptr from `this` pointer of the current ast node
15302  */
15303  std::shared_ptr<const Ast> get_shared_ptr() const override {
15304  return std::static_pointer_cast<const LocalVar>(shared_from_this());
15305  }
15306 
15307  /**
15308  * \brief Return associated token for the current ast node
15309  *
15310  * Not all ast nodes have token information. For example,
15311  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
15312  * solution of ODEs. In this case, we return nullptr to store in the
15313  * nmodl::symtab::SymbolTable.
15314  *
15315  * \return pointer to token if exist otherwise nullptr
15316  */
15317  const ModToken *get_token() const noexcept override { return token.get(); }
15318 
15319  /**
15320  * \brief Return name of the node
15321  *
15322  * Some ast nodes have a member marked designated as node name. For example,
15323  * in case of this ast::Identifier has name designated as a
15324  * node name.
15325  *
15326  * @return name of the node as std::string
15327  *
15328  * \sa Ast::get_node_type_name
15329  */
15330  std::string get_node_name() const override;
15331 
15332  /**
15333  * \brief Getter for member variable \ref LocalVar.name
15334  */
15335  const std::shared_ptr<Identifier> &get_name() const noexcept { return name; }
15336 
15337  /// \}
15338 
15339  /// \name Setters
15340  /// \{
15341 
15342  /**
15343  * \brief Set token for the current ast node
15344  */
15345  void set_token(const ModToken &tok) {
15346  token = std::make_shared<ModToken>(tok);
15347  }
15348 
15349  /**
15350  * \brief Setter for member variable \ref LocalVar.name (rvalue reference)
15351  */
15352  void set_name(std::shared_ptr<Identifier> &&name);
15353 
15354  /**
15355  * \brief Setter for member variable \ref LocalVar.name
15356  */
15357  void set_name(const std::shared_ptr<Identifier> &name);
15358 
15359  /// \}
15360 
15361  /// \name Visitor
15362  /// \{
15363 
15364  /**
15365  * \brief visit children i.e. member variables of current node using provided
15366  * visitor
15367  *
15368  * Different nodes in the AST have different members (i.e. children). This
15369  * method recursively visits children using provided visitor.
15370  *
15371  * \param v Concrete visitor that will be used to recursively visit children
15372  *
15373  * \sa Ast::visit_children for example.
15374  */
15375  void visit_children(visitor::Visitor &v) override;
15376 
15377  /**
15378  * \brief visit children i.e. member variables of current node using provided
15379  * visitor
15380  *
15381  * Different nodes in the AST have different members (i.e. children). This
15382  * method recursively visits children using provided visitor.
15383  *
15384  * \param v Concrete constant visitor that will be used to recursively visit
15385  * children
15386  *
15387  * \sa Ast::visit_children for example.
15388  */
15389  void visit_children(visitor::ConstVisitor &v) const override;
15390 
15391  /**
15392  * \brief accept (or visit) the current AST node using provided visitor
15393  *
15394  * Instead of visiting children of AST node, like Ast::visit_children,
15395  * accept allows to visit the current node itself using provided concrete
15396  * visitor.
15397  *
15398  * \param v Concrete visitor that will be used to recursively visit node
15399  *
15400  * \sa Ast::accept for example.
15401  */
15402  void accept(visitor::Visitor &v) override;
15403 
15404  /**
15405  * \copydoc accept(visitor::Visitor&)
15406  */
15407  void accept(visitor::ConstVisitor &v) const override;
15408 
15409  /// \}
15410 
15411 private:
15412  /**
15413  * \brief Set this object as parent for all the children
15414  *
15415  * This should be called in every object (with children) constructor
15416  * to set parents. Since it is called only in the constructors it
15417  * should not be virtual to avoid ambiguities (issue #295).
15418  */
15419  void set_parent_in_children();
15420 };
15421 
15422 /** @} */ // end of ast_class
15423 
15424 } // namespace ast
15425 } // namespace nmodl
15426 #endif // !NMODL_AST_LOCAL_VAR_HPP
15427 #ifndef NMODL_AST_LIMITS_HPP
15428 #define NMODL_AST_LIMITS_HPP
15429 
15430 namespace nmodl {
15431 namespace ast {
15432 
15433 /**
15434  * @addtogroup ast_class
15435  * @ingroup ast
15436  * @{
15437  */
15438 
15439 /**
15440  * \brief TODO
15441  *
15442  *
15443  */
15444 class Limits : public Expression {
15445 private:
15446  /// TODO
15447  std::shared_ptr<Double> min;
15448  /// TODO
15449  std::shared_ptr<Double> max;
15450  /// token with location information
15451  std::shared_ptr<ModToken> token;
15452 
15453 public:
15454  /// \name Ctor & dtor
15455  /// \{
15456 
15457  explicit Limits(Double *min, Double *max);
15458  explicit Limits(const std::shared_ptr<Double> &min,
15459  const std::shared_ptr<Double> &max);
15460  Limits(const Limits &obj);
15461 
15462  virtual ~Limits() = default;
15463 
15464  /// \}
15465 
15466  /**
15467  * \brief Check if the ast node is an instance of ast::Limits
15468  * \return true as object is of type ast::Limits
15469  */
15470  bool is_limits() const noexcept override { return true; }
15471 
15472  /**
15473  * \brief Return a copy of the current node
15474  *
15475  * Recursively make a new copy/clone of the current node including
15476  * all members and return a pointer to the node. This is used for
15477  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
15478  * ast.
15479  *
15480  * @return pointer to the clone/copy of the current node
15481  */
15482  Limits *clone() const override { return new Limits(*this); }
15483 
15484  /// \name Getters
15485  /// \{
15486 
15487  /**
15488  * \brief Return type (ast::AstNodeType) of ast node
15489  *
15490  * Every node in the ast has a type defined in ast::AstNodeType and this
15491  * function is used to retrieve the same.
15492  *
15493  * \return ast node type i.e. ast::AstNodeType::LIMITS
15494  *
15495  * \sa Ast::get_node_type_name
15496  */
15497  AstNodeType get_node_type() const noexcept override {
15498  return AstNodeType::LIMITS;
15499  }
15500 
15501  /**
15502  * \brief Return type (ast::AstNodeType) of ast node as std::string
15503  *
15504  * Every node in the ast has a type defined in ast::AstNodeType.
15505  * This type name can be returned as a std::string for printing
15506  * node to text/json form.
15507  *
15508  * \return name of the node type as a string i.e. "Limits"
15509  *
15510  * \sa Ast::get_node_name
15511  */
15512  std::string get_node_type_name() const noexcept override { return "Limits"; }
15513 
15514  /**
15515  * \brief Get std::shared_ptr from `this` pointer of the current ast node
15516  */
15517  std::shared_ptr<Ast> get_shared_ptr() override {
15518  return std::static_pointer_cast<Limits>(shared_from_this());
15519  }
15520 
15521  /**
15522  * \brief Get std::shared_ptr from `this` pointer of the current ast node
15523  */
15524  std::shared_ptr<const Ast> get_shared_ptr() const override {
15525  return std::static_pointer_cast<const Limits>(shared_from_this());
15526  }
15527 
15528  /**
15529  * \brief Return associated token for the current ast node
15530  *
15531  * Not all ast nodes have token information. For example,
15532  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
15533  * solution of ODEs. In this case, we return nullptr to store in the
15534  * nmodl::symtab::SymbolTable.
15535  *
15536  * \return pointer to token if exist otherwise nullptr
15537  */
15538  const ModToken *get_token() const noexcept override { return token.get(); }
15539 
15540  /**
15541  * \brief Getter for member variable \ref Limits.min
15542  */
15543  const std::shared_ptr<Double> &get_min() const noexcept { return min; }
15544 
15545  /**
15546  * \brief Getter for member variable \ref Limits.max
15547  */
15548  const std::shared_ptr<Double> &get_max() const noexcept { return max; }
15549 
15550  /// \}
15551 
15552  /// \name Setters
15553  /// \{
15554 
15555  /**
15556  * \brief Set token for the current ast node
15557  */
15558  void set_token(const ModToken &tok) {
15559  token = std::make_shared<ModToken>(tok);
15560  }
15561 
15562  /**
15563  * \brief Setter for member variable \ref Limits.min (rvalue reference)
15564  */
15565  void set_min(std::shared_ptr<Double> &&min);
15566 
15567  /**
15568  * \brief Setter for member variable \ref Limits.min
15569  */
15570  void set_min(const std::shared_ptr<Double> &min);
15571 
15572  /**
15573  * \brief Setter for member variable \ref Limits.max (rvalue reference)
15574  */
15575  void set_max(std::shared_ptr<Double> &&max);
15576 
15577  /**
15578  * \brief Setter for member variable \ref Limits.max
15579  */
15580  void set_max(const std::shared_ptr<Double> &max);
15581 
15582  /// \}
15583 
15584  /// \name Visitor
15585  /// \{
15586 
15587  /**
15588  * \brief visit children i.e. member variables of current node using provided
15589  * visitor
15590  *
15591  * Different nodes in the AST have different members (i.e. children). This
15592  * method recursively visits children using provided visitor.
15593  *
15594  * \param v Concrete visitor that will be used to recursively visit children
15595  *
15596  * \sa Ast::visit_children for example.
15597  */
15598  void visit_children(visitor::Visitor &v) override;
15599 
15600  /**
15601  * \brief visit children i.e. member variables of current node using provided
15602  * visitor
15603  *
15604  * Different nodes in the AST have different members (i.e. children). This
15605  * method recursively visits children using provided visitor.
15606  *
15607  * \param v Concrete constant visitor that will be used to recursively visit
15608  * children
15609  *
15610  * \sa Ast::visit_children for example.
15611  */
15612  void visit_children(visitor::ConstVisitor &v) const override;
15613 
15614  /**
15615  * \brief accept (or visit) the current AST node using provided visitor
15616  *
15617  * Instead of visiting children of AST node, like Ast::visit_children,
15618  * accept allows to visit the current node itself using provided concrete
15619  * visitor.
15620  *
15621  * \param v Concrete visitor that will be used to recursively visit node
15622  *
15623  * \sa Ast::accept for example.
15624  */
15625  void accept(visitor::Visitor &v) override;
15626 
15627  /**
15628  * \copydoc accept(visitor::Visitor&)
15629  */
15630  void accept(visitor::ConstVisitor &v) const override;
15631 
15632  /// \}
15633 
15634 private:
15635  /**
15636  * \brief Set this object as parent for all the children
15637  *
15638  * This should be called in every object (with children) constructor
15639  * to set parents. Since it is called only in the constructors it
15640  * should not be virtual to avoid ambiguities (issue #295).
15641  */
15642  void set_parent_in_children();
15643 };
15644 
15645 /** @} */ // end of ast_class
15646 
15647 } // namespace ast
15648 } // namespace nmodl
15649 #endif // !NMODL_AST_LIMITS_HPP
15650 #ifndef NMODL_AST_NUMBER_RANGE_HPP
15651 #define NMODL_AST_NUMBER_RANGE_HPP
15652 
15653 namespace nmodl {
15654 namespace ast {
15655 
15656 /**
15657  * @addtogroup ast_class
15658  * @ingroup ast
15659  * @{
15660  */
15661 
15662 /**
15663  * \brief TODO
15664  *
15665  *
15666  */
15667 class NumberRange : public Expression {
15668 private:
15669  /// TODO
15670  std::shared_ptr<Number> min;
15671  /// TODO
15672  std::shared_ptr<Number> max;
15673  /// token with location information
15674  std::shared_ptr<ModToken> token;
15675 
15676 public:
15677  /// \name Ctor & dtor
15678  /// \{
15679 
15680  explicit NumberRange(Number *min, Number *max);
15681  explicit NumberRange(const std::shared_ptr<Number> &min,
15682  const std::shared_ptr<Number> &max);
15683  NumberRange(const NumberRange &obj);
15684 
15685  virtual ~NumberRange() = default;
15686 
15687  /// \}
15688 
15689  /**
15690  * \brief Check if the ast node is an instance of ast::NumberRange
15691  * \return true as object is of type ast::NumberRange
15692  */
15693  bool is_number_range() const noexcept override { return true; }
15694 
15695  /**
15696  * \brief Return a copy of the current node
15697  *
15698  * Recursively make a new copy/clone of the current node including
15699  * all members and return a pointer to the node. This is used for
15700  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
15701  * ast.
15702  *
15703  * @return pointer to the clone/copy of the current node
15704  */
15705  NumberRange *clone() const override { return new NumberRange(*this); }
15706 
15707  /// \name Getters
15708  /// \{
15709 
15710  /**
15711  * \brief Return type (ast::AstNodeType) of ast node
15712  *
15713  * Every node in the ast has a type defined in ast::AstNodeType and this
15714  * function is used to retrieve the same.
15715  *
15716  * \return ast node type i.e. ast::AstNodeType::NUMBER_RANGE
15717  *
15718  * \sa Ast::get_node_type_name
15719  */
15720  AstNodeType get_node_type() const noexcept override {
15722  }
15723 
15724  /**
15725  * \brief Return type (ast::AstNodeType) of ast node as std::string
15726  *
15727  * Every node in the ast has a type defined in ast::AstNodeType.
15728  * This type name can be returned as a std::string for printing
15729  * node to text/json form.
15730  *
15731  * \return name of the node type as a string i.e. "NumberRange"
15732  *
15733  * \sa Ast::get_node_name
15734  */
15735  std::string get_node_type_name() const noexcept override {
15736  return "NumberRange";
15737  }
15738 
15739  /**
15740  * \brief Get std::shared_ptr from `this` pointer of the current ast node
15741  */
15742  std::shared_ptr<Ast> get_shared_ptr() override {
15743  return std::static_pointer_cast<NumberRange>(shared_from_this());
15744  }
15745 
15746  /**
15747  * \brief Get std::shared_ptr from `this` pointer of the current ast node
15748  */
15749  std::shared_ptr<const Ast> get_shared_ptr() const override {
15750  return std::static_pointer_cast<const NumberRange>(shared_from_this());
15751  }
15752 
15753  /**
15754  * \brief Return associated token for the current ast node
15755  *
15756  * Not all ast nodes have token information. For example,
15757  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
15758  * solution of ODEs. In this case, we return nullptr to store in the
15759  * nmodl::symtab::SymbolTable.
15760  *
15761  * \return pointer to token if exist otherwise nullptr
15762  */
15763  const ModToken *get_token() const noexcept override { return token.get(); }
15764 
15765  /**
15766  * \brief Getter for member variable \ref NumberRange.min
15767  */
15768  const std::shared_ptr<Number> &get_min() const noexcept { return min; }
15769 
15770  /**
15771  * \brief Getter for member variable \ref NumberRange.max
15772  */
15773  const std::shared_ptr<Number> &get_max() const noexcept { return max; }
15774 
15775  /// \}
15776 
15777  /// \name Setters
15778  /// \{
15779 
15780  /**
15781  * \brief Set token for the current ast node
15782  */
15783  void set_token(const ModToken &tok) {
15784  token = std::make_shared<ModToken>(tok);
15785  }
15786 
15787  /**
15788  * \brief Setter for member variable \ref NumberRange.min (rvalue reference)
15789  */
15790  void set_min(std::shared_ptr<Number> &&min);
15791 
15792  /**
15793  * \brief Setter for member variable \ref NumberRange.min
15794  */
15795  void set_min(const std::shared_ptr<Number> &min);
15796 
15797  /**
15798  * \brief Setter for member variable \ref NumberRange.max (rvalue reference)
15799  */
15800  void set_max(std::shared_ptr<Number> &&max);
15801 
15802  /**
15803  * \brief Setter for member variable \ref NumberRange.max
15804  */
15805  void set_max(const std::shared_ptr<Number> &max);
15806 
15807  /// \}
15808 
15809  /// \name Visitor
15810  /// \{
15811 
15812  /**
15813  * \brief visit children i.e. member variables of current node using provided
15814  * visitor
15815  *
15816  * Different nodes in the AST have different members (i.e. children). This
15817  * method recursively visits children using provided visitor.
15818  *
15819  * \param v Concrete visitor that will be used to recursively visit children
15820  *
15821  * \sa Ast::visit_children for example.
15822  */
15823  void visit_children(visitor::Visitor &v) override;
15824 
15825  /**
15826  * \brief visit children i.e. member variables of current node using provided
15827  * visitor
15828  *
15829  * Different nodes in the AST have different members (i.e. children). This
15830  * method recursively visits children using provided visitor.
15831  *
15832  * \param v Concrete constant visitor that will be used to recursively visit
15833  * children
15834  *
15835  * \sa Ast::visit_children for example.
15836  */
15837  void visit_children(visitor::ConstVisitor &v) const override;
15838 
15839  /**
15840  * \brief accept (or visit) the current AST node using provided visitor
15841  *
15842  * Instead of visiting children of AST node, like Ast::visit_children,
15843  * accept allows to visit the current node itself using provided concrete
15844  * visitor.
15845  *
15846  * \param v Concrete visitor that will be used to recursively visit node
15847  *
15848  * \sa Ast::accept for example.
15849  */
15850  void accept(visitor::Visitor &v) override;
15851 
15852  /**
15853  * \copydoc accept(visitor::Visitor&)
15854  */
15855  void accept(visitor::ConstVisitor &v) const override;
15856 
15857  /// \}
15858 
15859 private:
15860  /**
15861  * \brief Set this object as parent for all the children
15862  *
15863  * This should be called in every object (with children) constructor
15864  * to set parents. Since it is called only in the constructors it
15865  * should not be virtual to avoid ambiguities (issue #295).
15866  */
15867  void set_parent_in_children();
15868 };
15869 
15870 /** @} */ // end of ast_class
15871 
15872 } // namespace ast
15873 } // namespace nmodl
15874 #endif // !NMODL_AST_NUMBER_RANGE_HPP
15875 #ifndef NMODL_AST_PLOT_VAR_HPP
15876 #define NMODL_AST_PLOT_VAR_HPP
15877 
15878 namespace nmodl {
15879 namespace ast {
15880 
15881 /**
15882  * @addtogroup ast_class
15883  * @ingroup ast
15884  * @{
15885  */
15886 
15887 /**
15888  * \brief TODO
15889  *
15890  *
15891  */
15892 class PlotVar : public Expression {
15893 private:
15894  /// TODO
15895  std::shared_ptr<Identifier> name;
15896  /// TODO
15897  std::shared_ptr<Integer> index;
15898  /// token with location information
15899  std::shared_ptr<ModToken> token;
15900 
15901 public:
15902  /// \name Ctor & dtor
15903  /// \{
15904 
15905  explicit PlotVar(Identifier *name, Integer *index);
15906  explicit PlotVar(const std::shared_ptr<Identifier> &name,
15907  const std::shared_ptr<Integer> &index);
15908  PlotVar(const PlotVar &obj);
15909 
15910  virtual ~PlotVar() = default;
15911 
15912  /// \}
15913 
15914  /**
15915  * \brief Check if the ast node is an instance of ast::PlotVar
15916  * \return true as object is of type ast::PlotVar
15917  */
15918  bool is_plot_var() const noexcept override { return true; }
15919 
15920  /**
15921  * \brief Return a copy of the current node
15922  *
15923  * Recursively make a new copy/clone of the current node including
15924  * all members and return a pointer to the node. This is used for
15925  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
15926  * ast.
15927  *
15928  * @return pointer to the clone/copy of the current node
15929  */
15930  PlotVar *clone() const override { return new PlotVar(*this); }
15931 
15932  /// \name Getters
15933  /// \{
15934 
15935  /**
15936  * \brief Return type (ast::AstNodeType) of ast node
15937  *
15938  * Every node in the ast has a type defined in ast::AstNodeType and this
15939  * function is used to retrieve the same.
15940  *
15941  * \return ast node type i.e. ast::AstNodeType::PLOT_VAR
15942  *
15943  * \sa Ast::get_node_type_name
15944  */
15945  AstNodeType get_node_type() const noexcept override {
15946  return AstNodeType::PLOT_VAR;
15947  }
15948 
15949  /**
15950  * \brief Return type (ast::AstNodeType) of ast node as std::string
15951  *
15952  * Every node in the ast has a type defined in ast::AstNodeType.
15953  * This type name can be returned as a std::string for printing
15954  * node to text/json form.
15955  *
15956  * \return name of the node type as a string i.e. "PlotVar"
15957  *
15958  * \sa Ast::get_node_name
15959  */
15960  std::string get_node_type_name() const noexcept override { return "PlotVar"; }
15961 
15962  /**
15963  * \brief Get std::shared_ptr from `this` pointer of the current ast node
15964  */
15965  std::shared_ptr<Ast> get_shared_ptr() override {
15966  return std::static_pointer_cast<PlotVar>(shared_from_this());
15967  }
15968 
15969  /**
15970  * \brief Get std::shared_ptr from `this` pointer of the current ast node
15971  */
15972  std::shared_ptr<const Ast> get_shared_ptr() const override {
15973  return std::static_pointer_cast<const PlotVar>(shared_from_this());
15974  }
15975 
15976  /**
15977  * \brief Return associated token for the current ast node
15978  *
15979  * Not all ast nodes have token information. For example,
15980  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
15981  * solution of ODEs. In this case, we return nullptr to store in the
15982  * nmodl::symtab::SymbolTable.
15983  *
15984  * \return pointer to token if exist otherwise nullptr
15985  */
15986  const ModToken *get_token() const noexcept override { return token.get(); }
15987 
15988  /**
15989  * \brief Getter for member variable \ref PlotVar.name
15990  */
15991  const std::shared_ptr<Identifier> &get_name() const noexcept { return name; }
15992 
15993  /**
15994  * \brief Getter for member variable \ref PlotVar.index
15995  */
15996  const std::shared_ptr<Integer> &get_index() const noexcept { return index; }
15997 
15998  /// \}
15999 
16000  /// \name Setters
16001  /// \{
16002 
16003  /**
16004  * \brief Set token for the current ast node
16005  */
16006  void set_token(const ModToken &tok) {
16007  token = std::make_shared<ModToken>(tok);
16008  }
16009 
16010  /**
16011  * \brief Setter for member variable \ref PlotVar.name (rvalue reference)
16012  */
16013  void set_name(std::shared_ptr<Identifier> &&name);
16014 
16015  /**
16016  * \brief Setter for member variable \ref PlotVar.name
16017  */
16018  void set_name(const std::shared_ptr<Identifier> &name);
16019 
16020  /**
16021  * \brief Setter for member variable \ref PlotVar.index (rvalue reference)
16022  */
16023  void set_index(std::shared_ptr<Integer> &&index);
16024 
16025  /**
16026  * \brief Setter for member variable \ref PlotVar.index
16027  */
16028  void set_index(const std::shared_ptr<Integer> &index);
16029 
16030  /// \}
16031 
16032  /// \name Visitor
16033  /// \{
16034 
16035  /**
16036  * \brief visit children i.e. member variables of current node using provided
16037  * visitor
16038  *
16039  * Different nodes in the AST have different members (i.e. children). This
16040  * method recursively visits children using provided visitor.
16041  *
16042  * \param v Concrete visitor that will be used to recursively visit children
16043  *
16044  * \sa Ast::visit_children for example.
16045  */
16046  void visit_children(visitor::Visitor &v) override;
16047 
16048  /**
16049  * \brief visit children i.e. member variables of current node using provided
16050  * visitor
16051  *
16052  * Different nodes in the AST have different members (i.e. children). This
16053  * method recursively visits children using provided visitor.
16054  *
16055  * \param v Concrete constant visitor that will be used to recursively visit
16056  * children
16057  *
16058  * \sa Ast::visit_children for example.
16059  */
16060  void visit_children(visitor::ConstVisitor &v) const override;
16061 
16062  /**
16063  * \brief accept (or visit) the current AST node using provided visitor
16064  *
16065  * Instead of visiting children of AST node, like Ast::visit_children,
16066  * accept allows to visit the current node itself using provided concrete
16067  * visitor.
16068  *
16069  * \param v Concrete visitor that will be used to recursively visit node
16070  *
16071  * \sa Ast::accept for example.
16072  */
16073  void accept(visitor::Visitor &v) override;
16074 
16075  /**
16076  * \copydoc accept(visitor::Visitor&)
16077  */
16078  void accept(visitor::ConstVisitor &v) const override;
16079 
16080  /// \}
16081 
16082 private:
16083  /**
16084  * \brief Set this object as parent for all the children
16085  *
16086  * This should be called in every object (with children) constructor
16087  * to set parents. Since it is called only in the constructors it
16088  * should not be virtual to avoid ambiguities (issue #295).
16089  */
16090  void set_parent_in_children();
16091 };
16092 
16093 /** @} */ // end of ast_class
16094 
16095 } // namespace ast
16096 } // namespace nmodl
16097 #endif // !NMODL_AST_PLOT_VAR_HPP
16098 #ifndef NMODL_AST_CONSTANT_VAR_HPP
16099 #define NMODL_AST_CONSTANT_VAR_HPP
16100 
16101 namespace nmodl {
16102 namespace ast {
16103 
16104 /**
16105  * @addtogroup ast_class
16106  * @ingroup ast
16107  * @{
16108  */
16109 
16110 /**
16111  * \brief Represents a variable in the ast::ConstantBlock
16112  *
16113  *
16114  */
16115 class ConstantVar : public Expression {
16116 private:
16117  /// Name of the variable
16118  std::shared_ptr<Name> name;
16119  /// Value of the constant
16120  std::shared_ptr<Number> value;
16121  /// Unit for the variable
16122  std::shared_ptr<Unit> unit;
16123  /// token with location information
16124  std::shared_ptr<ModToken> token;
16125 
16126 public:
16127  /// \name Ctor & dtor
16128  /// \{
16129 
16130  explicit ConstantVar(Name *name, Number *value, Unit *unit);
16131  explicit ConstantVar(const std::shared_ptr<Name> &name,
16132  const std::shared_ptr<Number> &value,
16133  const std::shared_ptr<Unit> &unit);
16134  ConstantVar(const ConstantVar &obj);
16135 
16136  virtual ~ConstantVar() = default;
16137 
16138  /// \}
16139 
16140  /**
16141  * \brief Check if the ast node is an instance of ast::ConstantVar
16142  * \return true as object is of type ast::ConstantVar
16143  */
16144  bool is_constant_var() const noexcept override { return true; }
16145 
16146  /**
16147  * \brief Return a copy of the current node
16148  *
16149  * Recursively make a new copy/clone of the current node including
16150  * all members and return a pointer to the node. This is used for
16151  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
16152  * ast.
16153  *
16154  * @return pointer to the clone/copy of the current node
16155  */
16156  ConstantVar *clone() const override { return new ConstantVar(*this); }
16157 
16158  /// \name Getters
16159  /// \{
16160 
16161  /**
16162  * \brief Return type (ast::AstNodeType) of ast node
16163  *
16164  * Every node in the ast has a type defined in ast::AstNodeType and this
16165  * function is used to retrieve the same.
16166  *
16167  * \return ast node type i.e. ast::AstNodeType::CONSTANT_VAR
16168  *
16169  * \sa Ast::get_node_type_name
16170  */
16171  AstNodeType get_node_type() const noexcept override {
16173  }
16174 
16175  /**
16176  * \brief Return type (ast::AstNodeType) of ast node as std::string
16177  *
16178  * Every node in the ast has a type defined in ast::AstNodeType.
16179  * This type name can be returned as a std::string for printing
16180  * node to text/json form.
16181  *
16182  * \return name of the node type as a string i.e. "ConstantVar"
16183  *
16184  * \sa Ast::get_node_name
16185  */
16186  std::string get_node_type_name() const noexcept override {
16187  return "ConstantVar";
16188  }
16189 
16190  /**
16191  * \brief Get std::shared_ptr from `this` pointer of the current ast node
16192  */
16193  std::shared_ptr<Ast> get_shared_ptr() override {
16194  return std::static_pointer_cast<ConstantVar>(shared_from_this());
16195  }
16196 
16197  /**
16198  * \brief Get std::shared_ptr from `this` pointer of the current ast node
16199  */
16200  std::shared_ptr<const Ast> get_shared_ptr() const override {
16201  return std::static_pointer_cast<const ConstantVar>(shared_from_this());
16202  }
16203 
16204  /**
16205  * \brief Return associated token for the current ast node
16206  *
16207  * Not all ast nodes have token information. For example,
16208  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
16209  * solution of ODEs. In this case, we return nullptr to store in the
16210  * nmodl::symtab::SymbolTable.
16211  *
16212  * \return pointer to token if exist otherwise nullptr
16213  */
16214  const ModToken *get_token() const noexcept override { return token.get(); }
16215 
16216  /**
16217  * \brief Return name of the node
16218  *
16219  * Some ast nodes have a member marked designated as node name. For example,
16220  * in case of this ast::Name has name designated as a
16221  * node name.
16222  *
16223  * @return name of the node as std::string
16224  *
16225  * \sa Ast::get_node_type_name
16226  */
16227  std::string get_node_name() const override;
16228 
16229  /**
16230  * \brief Getter for member variable \ref ConstantVar.name
16231  */
16232  const std::shared_ptr<Name> &get_name() const noexcept { return name; }
16233 
16234  /**
16235  * \brief Getter for member variable \ref ConstantVar.value
16236  */
16237  const std::shared_ptr<Number> &get_value() const noexcept { return value; }
16238 
16239  /**
16240  * \brief Getter for member variable \ref ConstantVar.unit
16241  */
16242  const std::shared_ptr<Unit> &get_unit() const noexcept { return unit; }
16243 
16244  /// \}
16245 
16246  /// \name Setters
16247  /// \{
16248 
16249  /**
16250  * \brief Set token for the current ast node
16251  */
16252  void set_token(const ModToken &tok) {
16253  token = std::make_shared<ModToken>(tok);
16254  }
16255 
16256  /**
16257  * \brief Setter for member variable \ref ConstantVar.name (rvalue reference)
16258  */
16259  void set_name(std::shared_ptr<Name> &&name);
16260 
16261  /**
16262  * \brief Setter for member variable \ref ConstantVar.name
16263  */
16264  void set_name(const std::shared_ptr<Name> &name);
16265 
16266  /**
16267  * \brief Setter for member variable \ref ConstantVar.value (rvalue reference)
16268  */
16269  void set_value(std::shared_ptr<Number> &&value);
16270 
16271  /**
16272  * \brief Setter for member variable \ref ConstantVar.value
16273  */
16274  void set_value(const std::shared_ptr<Number> &value);
16275 
16276  /**
16277  * \brief Setter for member variable \ref ConstantVar.unit (rvalue reference)
16278  */
16279  void set_unit(std::shared_ptr<Unit> &&unit);
16280 
16281  /**
16282  * \brief Setter for member variable \ref ConstantVar.unit
16283  */
16284  void set_unit(const std::shared_ptr<Unit> &unit);
16285 
16286  /// \}
16287 
16288  /// \name Visitor
16289  /// \{
16290 
16291  /**
16292  * \brief visit children i.e. member variables of current node using provided
16293  * visitor
16294  *
16295  * Different nodes in the AST have different members (i.e. children). This
16296  * method recursively visits children using provided visitor.
16297  *
16298  * \param v Concrete visitor that will be used to recursively visit children
16299  *
16300  * \sa Ast::visit_children for example.
16301  */
16302  void visit_children(visitor::Visitor &v) override;
16303 
16304  /**
16305  * \brief visit children i.e. member variables of current node using provided
16306  * visitor
16307  *
16308  * Different nodes in the AST have different members (i.e. children). This
16309  * method recursively visits children using provided visitor.
16310  *
16311  * \param v Concrete constant visitor that will be used to recursively visit
16312  * children
16313  *
16314  * \sa Ast::visit_children for example.
16315  */
16316  void visit_children(visitor::ConstVisitor &v) const override;
16317 
16318  /**
16319  * \brief accept (or visit) the current AST node using provided visitor
16320  *
16321  * Instead of visiting children of AST node, like Ast::visit_children,
16322  * accept allows to visit the current node itself using provided concrete
16323  * visitor.
16324  *
16325  * \param v Concrete visitor that will be used to recursively visit node
16326  *
16327  * \sa Ast::accept for example.
16328  */
16329  void accept(visitor::Visitor &v) override;
16330 
16331  /**
16332  * \copydoc accept(visitor::Visitor&)
16333  */
16334  void accept(visitor::ConstVisitor &v) const override;
16335 
16336  /// \}
16337 
16338 private:
16339  /**
16340  * \brief Set this object as parent for all the children
16341  *
16342  * This should be called in every object (with children) constructor
16343  * to set parents. Since it is called only in the constructors it
16344  * should not be virtual to avoid ambiguities (issue #295).
16345  */
16346  void set_parent_in_children();
16347 };
16348 
16349 /** @} */ // end of ast_class
16350 
16351 } // namespace ast
16352 } // namespace nmodl
16353 #endif // !NMODL_AST_CONSTANT_VAR_HPP
16354 #ifndef NMODL_AST_BINARY_OPERATOR_HPP
16355 #define NMODL_AST_BINARY_OPERATOR_HPP
16356 
16357 namespace nmodl {
16358 namespace ast {
16359 
16360 /**
16361  * @addtogroup ast_class
16362  * @ingroup ast
16363  * @{
16364  */
16365 
16366 /**
16367  * \brief Operator used in ast::BinaryExpression
16368  *
16369  *
16370  */
16371 class BinaryOperator : public Expression {
16372 private:
16373  /// Operator
16375  /// token with location information
16376  std::shared_ptr<ModToken> token;
16377 
16378 public:
16379  /// \name Ctor & dtor
16380  /// \{
16381 
16382  explicit BinaryOperator(BinaryOp value);
16383  BinaryOperator(const BinaryOperator &obj);
16384 
16385  BinaryOperator() = default;
16386 
16387  virtual ~BinaryOperator() = default;
16388 
16389  /// \}
16390 
16391  /**
16392  * \brief Check if the ast node is an instance of ast::BinaryOperator
16393  * \return true as object is of type ast::BinaryOperator
16394  */
16395  bool is_binary_operator() const noexcept override { return true; }
16396 
16397  /**
16398  * \brief Return a copy of the current node
16399  *
16400  * Recursively make a new copy/clone of the current node including
16401  * all members and return a pointer to the node. This is used for
16402  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
16403  * ast.
16404  *
16405  * @return pointer to the clone/copy of the current node
16406  */
16407  BinaryOperator *clone() const override { return new BinaryOperator(*this); }
16408 
16409  /// \name Getters
16410  /// \{
16411 
16412  /**
16413  * \brief Return type (ast::AstNodeType) of ast node
16414  *
16415  * Every node in the ast has a type defined in ast::AstNodeType and this
16416  * function is used to retrieve the same.
16417  *
16418  * \return ast node type i.e. ast::AstNodeType::BINARY_OPERATOR
16419  *
16420  * \sa Ast::get_node_type_name
16421  */
16422  AstNodeType get_node_type() const noexcept override {
16424  }
16425 
16426  /**
16427  * \brief Return type (ast::AstNodeType) of ast node as std::string
16428  *
16429  * Every node in the ast has a type defined in ast::AstNodeType.
16430  * This type name can be returned as a std::string for printing
16431  * node to text/json form.
16432  *
16433  * \return name of the node type as a string i.e. "BinaryOperator"
16434  *
16435  * \sa Ast::get_node_name
16436  */
16437  std::string get_node_type_name() const noexcept override {
16438  return "BinaryOperator";
16439  }
16440 
16441  /**
16442  * \brief Get std::shared_ptr from `this` pointer of the current ast node
16443  */
16444  std::shared_ptr<Ast> get_shared_ptr() override {
16445  return std::static_pointer_cast<BinaryOperator>(shared_from_this());
16446  }
16447 
16448  /**
16449  * \brief Get std::shared_ptr from `this` pointer of the current ast node
16450  */
16451  std::shared_ptr<const Ast> get_shared_ptr() const override {
16452  return std::static_pointer_cast<const BinaryOperator>(shared_from_this());
16453  }
16454 
16455  /**
16456  * \brief Return associated token for the current ast node
16457  *
16458  * Not all ast nodes have token information. For example,
16459  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
16460  * solution of ODEs. In this case, we return nullptr to store in the
16461  * nmodl::symtab::SymbolTable.
16462  *
16463  * \return pointer to token if exist otherwise nullptr
16464  */
16465  const ModToken *get_token() const noexcept override { return token.get(); }
16466 
16467  /**
16468  * \brief Getter for member variable \ref BinaryOperator.value
16469  */
16470  BinaryOp get_value() const noexcept { return value; }
16471 
16472  /// \}
16473 
16474  /// \name Setters
16475  /// \{
16476 
16477  /**
16478  * \brief Set token for the current ast node
16479  */
16480  void set_token(const ModToken &tok) {
16481  token = std::make_shared<ModToken>(tok);
16482  }
16483 
16484  /**
16485  * \brief Setter for member variable \ref BinaryOperator.value
16486  */
16487  void set_value(BinaryOp value);
16488 
16489  /// \}
16490 
16491  /// \name Visitor
16492  /// \{
16493 
16494  /**
16495  * \brief visit children i.e. member variables of current node using provided
16496  * visitor
16497  *
16498  * Different nodes in the AST have different members (i.e. children). This
16499  * method recursively visits children using provided visitor.
16500  *
16501  * \param v Concrete visitor that will be used to recursively visit children
16502  *
16503  * \sa Ast::visit_children for example.
16504  */
16505  void visit_children(visitor::Visitor &v) override;
16506 
16507  /**
16508  * \brief visit children i.e. member variables of current node using provided
16509  * visitor
16510  *
16511  * Different nodes in the AST have different members (i.e. children). This
16512  * method recursively visits children using provided visitor.
16513  *
16514  * \param v Concrete constant visitor that will be used to recursively visit
16515  * children
16516  *
16517  * \sa Ast::visit_children for example.
16518  */
16519  void visit_children(visitor::ConstVisitor &v) const override;
16520 
16521  /**
16522  * \brief accept (or visit) the current AST node using provided visitor
16523  *
16524  * Instead of visiting children of AST node, like Ast::visit_children,
16525  * accept allows to visit the current node itself using provided concrete
16526  * visitor.
16527  *
16528  * \param v Concrete visitor that will be used to recursively visit node
16529  *
16530  * \sa Ast::accept for example.
16531  */
16532  void accept(visitor::Visitor &v) override;
16533 
16534  /**
16535  * \copydoc accept(visitor::Visitor&)
16536  */
16537  void accept(visitor::ConstVisitor &v) const override;
16538 
16539  /// \}
16540 
16541  /**
16542  * \brief Return enum value in string form
16543  *
16544  * Enum variables (e.g. ast::BinaryOp, ast::UnitStateType) have
16545  * string representation when they are converted from AST back to
16546  * NMODL. This method is used to return corresponding string representation.
16547  */
16548  std::string eval() const { return BinaryOpNames[value]; }
16549 
16550 private:
16551  /**
16552  * \brief Set this object as parent for all the children
16553  *
16554  * This should be called in every object (with children) constructor
16555  * to set parents. Since it is called only in the constructors it
16556  * should not be virtual to avoid ambiguities (issue #295).
16557  */
16558  void set_parent_in_children();
16559 };
16560 
16561 /** @} */ // end of ast_class
16562 
16563 } // namespace ast
16564 } // namespace nmodl
16565 #endif // !NMODL_AST_BINARY_OPERATOR_HPP
16566 #ifndef NMODL_AST_UNARY_OPERATOR_HPP
16567 #define NMODL_AST_UNARY_OPERATOR_HPP
16568 
16569 namespace nmodl {
16570 namespace ast {
16571 
16572 /**
16573  * @addtogroup ast_class
16574  * @ingroup ast
16575  * @{
16576  */
16577 
16578 /**
16579  * \brief TODO
16580  *
16581  *
16582  */
16583 class UnaryOperator : public Expression {
16584 private:
16585  /// TODO
16587  /// token with location information
16588  std::shared_ptr<ModToken> token;
16589 
16590 public:
16591  /// \name Ctor & dtor
16592  /// \{
16593 
16594  explicit UnaryOperator(UnaryOp value);
16595  UnaryOperator(const UnaryOperator &obj);
16596 
16597  UnaryOperator() = default;
16598 
16599  virtual ~UnaryOperator() = default;
16600 
16601  /// \}
16602 
16603  /**
16604  * \brief Check if the ast node is an instance of ast::UnaryOperator
16605  * \return true as object is of type ast::UnaryOperator
16606  */
16607  bool is_unary_operator() const noexcept override { return true; }
16608 
16609  /**
16610  * \brief Return a copy of the current node
16611  *
16612  * Recursively make a new copy/clone of the current node including
16613  * all members and return a pointer to the node. This is used for
16614  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
16615  * ast.
16616  *
16617  * @return pointer to the clone/copy of the current node
16618  */
16619  UnaryOperator *clone() const override { return new UnaryOperator(*this); }
16620 
16621  /// \name Getters
16622  /// \{
16623 
16624  /**
16625  * \brief Return type (ast::AstNodeType) of ast node
16626  *
16627  * Every node in the ast has a type defined in ast::AstNodeType and this
16628  * function is used to retrieve the same.
16629  *
16630  * \return ast node type i.e. ast::AstNodeType::UNARY_OPERATOR
16631  *
16632  * \sa Ast::get_node_type_name
16633  */
16634  AstNodeType get_node_type() const noexcept override {
16636  }
16637 
16638  /**
16639  * \brief Return type (ast::AstNodeType) of ast node as std::string
16640  *
16641  * Every node in the ast has a type defined in ast::AstNodeType.
16642  * This type name can be returned as a std::string for printing
16643  * node to text/json form.
16644  *
16645  * \return name of the node type as a string i.e. "UnaryOperator"
16646  *
16647  * \sa Ast::get_node_name
16648  */
16649  std::string get_node_type_name() const noexcept override {
16650  return "UnaryOperator";
16651  }
16652 
16653  /**
16654  * \brief Get std::shared_ptr from `this` pointer of the current ast node
16655  */
16656  std::shared_ptr<Ast> get_shared_ptr() override {
16657  return std::static_pointer_cast<UnaryOperator>(shared_from_this());
16658  }
16659 
16660  /**
16661  * \brief Get std::shared_ptr from `this` pointer of the current ast node
16662  */
16663  std::shared_ptr<const Ast> get_shared_ptr() const override {
16664  return std::static_pointer_cast<const UnaryOperator>(shared_from_this());
16665  }
16666 
16667  /**
16668  * \brief Return associated token for the current ast node
16669  *
16670  * Not all ast nodes have token information. For example,
16671  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
16672  * solution of ODEs. In this case, we return nullptr to store in the
16673  * nmodl::symtab::SymbolTable.
16674  *
16675  * \return pointer to token if exist otherwise nullptr
16676  */
16677  const ModToken *get_token() const noexcept override { return token.get(); }
16678 
16679  /**
16680  * \brief Getter for member variable \ref UnaryOperator.value
16681  */
16682  UnaryOp get_value() const noexcept { return value; }
16683 
16684  /// \}
16685 
16686  /// \name Setters
16687  /// \{
16688 
16689  /**
16690  * \brief Set token for the current ast node
16691  */
16692  void set_token(const ModToken &tok) {
16693  token = std::make_shared<ModToken>(tok);
16694  }
16695 
16696  /**
16697  * \brief Setter for member variable \ref UnaryOperator.value
16698  */
16699  void set_value(UnaryOp value);
16700 
16701  /// \}
16702 
16703  /// \name Visitor
16704  /// \{
16705 
16706  /**
16707  * \brief visit children i.e. member variables of current node using provided
16708  * visitor
16709  *
16710  * Different nodes in the AST have different members (i.e. children). This
16711  * method recursively visits children using provided visitor.
16712  *
16713  * \param v Concrete visitor that will be used to recursively visit children
16714  *
16715  * \sa Ast::visit_children for example.
16716  */
16717  void visit_children(visitor::Visitor &v) override;
16718 
16719  /**
16720  * \brief visit children i.e. member variables of current node using provided
16721  * visitor
16722  *
16723  * Different nodes in the AST have different members (i.e. children). This
16724  * method recursively visits children using provided visitor.
16725  *
16726  * \param v Concrete constant visitor that will be used to recursively visit
16727  * children
16728  *
16729  * \sa Ast::visit_children for example.
16730  */
16731  void visit_children(visitor::ConstVisitor &v) const override;
16732 
16733  /**
16734  * \brief accept (or visit) the current AST node using provided visitor
16735  *
16736  * Instead of visiting children of AST node, like Ast::visit_children,
16737  * accept allows to visit the current node itself using provided concrete
16738  * visitor.
16739  *
16740  * \param v Concrete visitor that will be used to recursively visit node
16741  *
16742  * \sa Ast::accept for example.
16743  */
16744  void accept(visitor::Visitor &v) override;
16745 
16746  /**
16747  * \copydoc accept(visitor::Visitor&)
16748  */
16749  void accept(visitor::ConstVisitor &v) const override;
16750 
16751  /// \}
16752 
16753  /**
16754  * \brief Return enum value in string form
16755  *
16756  * Enum variables (e.g. ast::BinaryOp, ast::UnitStateType) have
16757  * string representation when they are converted from AST back to
16758  * NMODL. This method is used to return corresponding string representation.
16759  */
16760  std::string eval() const { return UnaryOpNames[value]; }
16761 
16762 private:
16763  /**
16764  * \brief Set this object as parent for all the children
16765  *
16766  * This should be called in every object (with children) constructor
16767  * to set parents. Since it is called only in the constructors it
16768  * should not be virtual to avoid ambiguities (issue #295).
16769  */
16770  void set_parent_in_children();
16771 };
16772 
16773 /** @} */ // end of ast_class
16774 
16775 } // namespace ast
16776 } // namespace nmodl
16777 #endif // !NMODL_AST_UNARY_OPERATOR_HPP
16778 #ifndef NMODL_AST_REACTION_OPERATOR_HPP
16779 #define NMODL_AST_REACTION_OPERATOR_HPP
16780 
16781 namespace nmodl {
16782 namespace ast {
16783 
16784 /**
16785  * @addtogroup ast_class
16786  * @ingroup ast
16787  * @{
16788  */
16789 
16790 /**
16791  * \brief TODO
16792  *
16793  *
16794  */
16796 private:
16797  /// TODO
16799  /// token with location information
16800  std::shared_ptr<ModToken> token;
16801 
16802 public:
16803  /// \name Ctor & dtor
16804  /// \{
16805 
16806  explicit ReactionOperator(ReactionOp value);
16807  ReactionOperator(const ReactionOperator &obj);
16808 
16809  ReactionOperator() = default;
16810 
16811  virtual ~ReactionOperator() = default;
16812 
16813  /// \}
16814 
16815  /**
16816  * \brief Check if the ast node is an instance of ast::ReactionOperator
16817  * \return true as object is of type ast::ReactionOperator
16818  */
16819  bool is_reaction_operator() const noexcept override { return true; }
16820 
16821  /**
16822  * \brief Return a copy of the current node
16823  *
16824  * Recursively make a new copy/clone of the current node including
16825  * all members and return a pointer to the node. This is used for
16826  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
16827  * ast.
16828  *
16829  * @return pointer to the clone/copy of the current node
16830  */
16831  ReactionOperator *clone() const override {
16832  return new ReactionOperator(*this);
16833  }
16834 
16835  /// \name Getters
16836  /// \{
16837 
16838  /**
16839  * \brief Return type (ast::AstNodeType) of ast node
16840  *
16841  * Every node in the ast has a type defined in ast::AstNodeType and this
16842  * function is used to retrieve the same.
16843  *
16844  * \return ast node type i.e. ast::AstNodeType::REACTION_OPERATOR
16845  *
16846  * \sa Ast::get_node_type_name
16847  */
16848  AstNodeType get_node_type() const noexcept override {
16850  }
16851 
16852  /**
16853  * \brief Return type (ast::AstNodeType) of ast node as std::string
16854  *
16855  * Every node in the ast has a type defined in ast::AstNodeType.
16856  * This type name can be returned as a std::string for printing
16857  * node to text/json form.
16858  *
16859  * \return name of the node type as a string i.e. "ReactionOperator"
16860  *
16861  * \sa Ast::get_node_name
16862  */
16863  std::string get_node_type_name() const noexcept override {
16864  return "ReactionOperator";
16865  }
16866 
16867  /**
16868  * \brief Get std::shared_ptr from `this` pointer of the current ast node
16869  */
16870  std::shared_ptr<Ast> get_shared_ptr() override {
16871  return std::static_pointer_cast<ReactionOperator>(shared_from_this());
16872  }
16873 
16874  /**
16875  * \brief Get std::shared_ptr from `this` pointer of the current ast node
16876  */
16877  std::shared_ptr<const Ast> get_shared_ptr() const override {
16878  return std::static_pointer_cast<const ReactionOperator>(shared_from_this());
16879  }
16880 
16881  /**
16882  * \brief Return associated token for the current ast node
16883  *
16884  * Not all ast nodes have token information. For example,
16885  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
16886  * solution of ODEs. In this case, we return nullptr to store in the
16887  * nmodl::symtab::SymbolTable.
16888  *
16889  * \return pointer to token if exist otherwise nullptr
16890  */
16891  const ModToken *get_token() const noexcept override { return token.get(); }
16892 
16893  /**
16894  * \brief Getter for member variable \ref ReactionOperator.value
16895  */
16896  ReactionOp get_value() const noexcept { return value; }
16897 
16898  /// \}
16899 
16900  /// \name Setters
16901  /// \{
16902 
16903  /**
16904  * \brief Set token for the current ast node
16905  */
16906  void set_token(const ModToken &tok) {
16907  token = std::make_shared<ModToken>(tok);
16908  }
16909 
16910  /**
16911  * \brief Setter for member variable \ref ReactionOperator.value
16912  */
16913  void set_value(ReactionOp value);
16914 
16915  /// \}
16916 
16917  /// \name Visitor
16918  /// \{
16919 
16920  /**
16921  * \brief visit children i.e. member variables of current node using provided
16922  * visitor
16923  *
16924  * Different nodes in the AST have different members (i.e. children). This
16925  * method recursively visits children using provided visitor.
16926  *
16927  * \param v Concrete visitor that will be used to recursively visit children
16928  *
16929  * \sa Ast::visit_children for example.
16930  */
16931  void visit_children(visitor::Visitor &v) override;
16932 
16933  /**
16934  * \brief visit children i.e. member variables of current node using provided
16935  * visitor
16936  *
16937  * Different nodes in the AST have different members (i.e. children). This
16938  * method recursively visits children using provided visitor.
16939  *
16940  * \param v Concrete constant visitor that will be used to recursively visit
16941  * children
16942  *
16943  * \sa Ast::visit_children for example.
16944  */
16945  void visit_children(visitor::ConstVisitor &v) const override;
16946 
16947  /**
16948  * \brief accept (or visit) the current AST node using provided visitor
16949  *
16950  * Instead of visiting children of AST node, like Ast::visit_children,
16951  * accept allows to visit the current node itself using provided concrete
16952  * visitor.
16953  *
16954  * \param v Concrete visitor that will be used to recursively visit node
16955  *
16956  * \sa Ast::accept for example.
16957  */
16958  void accept(visitor::Visitor &v) override;
16959 
16960  /**
16961  * \copydoc accept(visitor::Visitor&)
16962  */
16963  void accept(visitor::ConstVisitor &v) const override;
16964 
16965  /// \}
16966 
16967  /**
16968  * \brief Return enum value in string form
16969  *
16970  * Enum variables (e.g. ast::BinaryOp, ast::UnitStateType) have
16971  * string representation when they are converted from AST back to
16972  * NMODL. This method is used to return corresponding string representation.
16973  */
16974  std::string eval() const { return ReactionOpNames[value]; }
16975 
16976 private:
16977  /**
16978  * \brief Set this object as parent for all the children
16979  *
16980  * This should be called in every object (with children) constructor
16981  * to set parents. Since it is called only in the constructors it
16982  * should not be virtual to avoid ambiguities (issue #295).
16983  */
16984  void set_parent_in_children();
16985 };
16986 
16987 /** @} */ // end of ast_class
16988 
16989 } // namespace ast
16990 } // namespace nmodl
16991 #endif // !NMODL_AST_REACTION_OPERATOR_HPP
16992 #ifndef NMODL_AST_PAREN_EXPRESSION_HPP
16993 #define NMODL_AST_PAREN_EXPRESSION_HPP
16994 
16995 namespace nmodl {
16996 namespace ast {
16997 
16998 /**
16999  * @addtogroup ast_class
17000  * @ingroup ast
17001  * @{
17002  */
17003 
17004 /**
17005  * \brief TODO
17006  *
17007  *
17008  */
17009 class ParenExpression : public Expression {
17010 private:
17011  /// TODO
17012  std::shared_ptr<Expression> expression;
17013  /// token with location information
17014  std::shared_ptr<ModToken> token;
17015 
17016 public:
17017  /// \name Ctor & dtor
17018  /// \{
17019 
17020  explicit ParenExpression(Expression *expression);
17021  explicit ParenExpression(const std::shared_ptr<Expression> &expression);
17022  ParenExpression(const ParenExpression &obj);
17023 
17024  virtual ~ParenExpression() = default;
17025 
17026  /// \}
17027 
17028  /**
17029  * \brief Check if the ast node is an instance of ast::ParenExpression
17030  * \return true as object is of type ast::ParenExpression
17031  */
17032  bool is_paren_expression() const noexcept override { return true; }
17033 
17034  /**
17035  * \brief Return a copy of the current node
17036  *
17037  * Recursively make a new copy/clone of the current node including
17038  * all members and return a pointer to the node. This is used for
17039  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
17040  * ast.
17041  *
17042  * @return pointer to the clone/copy of the current node
17043  */
17044  ParenExpression *clone() const override { return new ParenExpression(*this); }
17045 
17046  /// \name Getters
17047  /// \{
17048 
17049  /**
17050  * \brief Return type (ast::AstNodeType) of ast node
17051  *
17052  * Every node in the ast has a type defined in ast::AstNodeType and this
17053  * function is used to retrieve the same.
17054  *
17055  * \return ast node type i.e. ast::AstNodeType::PAREN_EXPRESSION
17056  *
17057  * \sa Ast::get_node_type_name
17058  */
17059  AstNodeType get_node_type() const noexcept override {
17061  }
17062 
17063  /**
17064  * \brief Return type (ast::AstNodeType) of ast node as std::string
17065  *
17066  * Every node in the ast has a type defined in ast::AstNodeType.
17067  * This type name can be returned as a std::string for printing
17068  * node to text/json form.
17069  *
17070  * \return name of the node type as a string i.e. "ParenExpression"
17071  *
17072  * \sa Ast::get_node_name
17073  */
17074  std::string get_node_type_name() const noexcept override {
17075  return "ParenExpression";
17076  }
17077 
17078  /**
17079  * \brief Get std::shared_ptr from `this` pointer of the current ast node
17080  */
17081  std::shared_ptr<Ast> get_shared_ptr() override {
17082  return std::static_pointer_cast<ParenExpression>(shared_from_this());
17083  }
17084 
17085  /**
17086  * \brief Get std::shared_ptr from `this` pointer of the current ast node
17087  */
17088  std::shared_ptr<const Ast> get_shared_ptr() const override {
17089  return std::static_pointer_cast<const ParenExpression>(shared_from_this());
17090  }
17091 
17092  /**
17093  * \brief Return associated token for the current ast node
17094  *
17095  * Not all ast nodes have token information. For example,
17096  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
17097  * solution of ODEs. In this case, we return nullptr to store in the
17098  * nmodl::symtab::SymbolTable.
17099  *
17100  * \return pointer to token if exist otherwise nullptr
17101  */
17102  const ModToken *get_token() const noexcept override { return token.get(); }
17103 
17104  /**
17105  * \brief Getter for member variable \ref ParenExpression.expression
17106  */
17107  const std::shared_ptr<Expression> &get_expression() const noexcept {
17108  return expression;
17109  }
17110 
17111  /// \}
17112 
17113  /// \name Setters
17114  /// \{
17115 
17116  /**
17117  * \brief Set token for the current ast node
17118  */
17119  void set_token(const ModToken &tok) {
17120  token = std::make_shared<ModToken>(tok);
17121  }
17122 
17123  /**
17124  * \brief Setter for member variable \ref ParenExpression.expression (rvalue
17125  * reference)
17126  */
17127  void set_expression(std::shared_ptr<Expression> &&expression);
17128 
17129  /**
17130  * \brief Setter for member variable \ref ParenExpression.expression
17131  */
17132  void set_expression(const std::shared_ptr<Expression> &expression);
17133 
17134  /// \}
17135 
17136  /// \name Visitor
17137  /// \{
17138 
17139  /**
17140  * \brief visit children i.e. member variables of current node using provided
17141  * visitor
17142  *
17143  * Different nodes in the AST have different members (i.e. children). This
17144  * method recursively visits children using provided visitor.
17145  *
17146  * \param v Concrete visitor that will be used to recursively visit children
17147  *
17148  * \sa Ast::visit_children for example.
17149  */
17150  void visit_children(visitor::Visitor &v) override;
17151 
17152  /**
17153  * \brief visit children i.e. member variables of current node using provided
17154  * visitor
17155  *
17156  * Different nodes in the AST have different members (i.e. children). This
17157  * method recursively visits children using provided visitor.
17158  *
17159  * \param v Concrete constant visitor that will be used to recursively visit
17160  * children
17161  *
17162  * \sa Ast::visit_children for example.
17163  */
17164  void visit_children(visitor::ConstVisitor &v) const override;
17165 
17166  /**
17167  * \brief accept (or visit) the current AST node using provided visitor
17168  *
17169  * Instead of visiting children of AST node, like Ast::visit_children,
17170  * accept allows to visit the current node itself using provided concrete
17171  * visitor.
17172  *
17173  * \param v Concrete visitor that will be used to recursively visit node
17174  *
17175  * \sa Ast::accept for example.
17176  */
17177  void accept(visitor::Visitor &v) override;
17178 
17179  /**
17180  * \copydoc accept(visitor::Visitor&)
17181  */
17182  void accept(visitor::ConstVisitor &v) const override;
17183 
17184  /// \}
17185 
17186 private:
17187  /**
17188  * \brief Set this object as parent for all the children
17189  *
17190  * This should be called in every object (with children) constructor
17191  * to set parents. Since it is called only in the constructors it
17192  * should not be virtual to avoid ambiguities (issue #295).
17193  */
17194  void set_parent_in_children();
17195 };
17196 
17197 /** @} */ // end of ast_class
17198 
17199 } // namespace ast
17200 } // namespace nmodl
17201 #endif // !NMODL_AST_PAREN_EXPRESSION_HPP
17202 #ifndef NMODL_AST_BINARY_EXPRESSION_HPP
17203 #define NMODL_AST_BINARY_EXPRESSION_HPP
17204 
17205 namespace nmodl {
17206 namespace ast {
17207 
17208 /**
17209  * @addtogroup ast_class
17210  * @ingroup ast
17211  * @{
17212  */
17213 
17214 /**
17215  * \brief Represents binary expression in the NMODL
17216  *
17217  * Any binary expression in the mod file is represented by this node type.
17218  * For example, in below example, there are three binary expressions :
17219  *
17220  * \code{.mod}
17221  * BREAKPOINT {
17222  * SOLVE states METHOD cnexp
17223  * ina = gna*(v - ena)
17224  * }
17225  * \endcode
17226  *
17227  * Note that the statement itself is stored in another type
17228  * ast::ExpressionStatement.
17229  *
17230  * \sa ast::ExpressionStatement
17231  *
17232  */
17234 private:
17235  /// LHS of the binary expression
17236  std::shared_ptr<Expression> lhs;
17237  /// Operator
17239  /// RHS of the binary expression
17240  std::shared_ptr<Expression> rhs;
17241  /// token with location information
17242  std::shared_ptr<ModToken> token;
17243 
17244 public:
17245  /// \name Ctor & dtor
17246  /// \{
17247 
17248  explicit BinaryExpression(Expression *lhs, const BinaryOperator &op,
17249  Expression *rhs);
17250  explicit BinaryExpression(const std::shared_ptr<Expression> &lhs,
17251  const BinaryOperator &op,
17252  const std::shared_ptr<Expression> &rhs);
17253  BinaryExpression(const BinaryExpression &obj);
17254 
17255  virtual ~BinaryExpression() = default;
17256 
17257  /// \}
17258 
17259  /**
17260  * \brief Check if the ast node is an instance of ast::BinaryExpression
17261  * \return true as object is of type ast::BinaryExpression
17262  */
17263  bool is_binary_expression() const noexcept override { return true; }
17264 
17265  /**
17266  * \brief Return a copy of the current node
17267  *
17268  * Recursively make a new copy/clone of the current node including
17269  * all members and return a pointer to the node. This is used for
17270  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
17271  * ast.
17272  *
17273  * @return pointer to the clone/copy of the current node
17274  */
17275  BinaryExpression *clone() const override {
17276  return new BinaryExpression(*this);
17277  }
17278 
17279  /// \name Getters
17280  /// \{
17281 
17282  /**
17283  * \brief Return type (ast::AstNodeType) of ast node
17284  *
17285  * Every node in the ast has a type defined in ast::AstNodeType and this
17286  * function is used to retrieve the same.
17287  *
17288  * \return ast node type i.e. ast::AstNodeType::BINARY_EXPRESSION
17289  *
17290  * \sa Ast::get_node_type_name
17291  */
17292  AstNodeType get_node_type() const noexcept override {
17294  }
17295 
17296  /**
17297  * \brief Return type (ast::AstNodeType) of ast node as std::string
17298  *
17299  * Every node in the ast has a type defined in ast::AstNodeType.
17300  * This type name can be returned as a std::string for printing
17301  * node to text/json form.
17302  *
17303  * \return name of the node type as a string i.e. "BinaryExpression"
17304  *
17305  * \sa Ast::get_node_name
17306  */
17307  std::string get_node_type_name() const noexcept override {
17308  return "BinaryExpression";
17309  }
17310 
17311  /**
17312  * \brief Get std::shared_ptr from `this` pointer of the current ast node
17313  */
17314  std::shared_ptr<Ast> get_shared_ptr() override {
17315  return std::static_pointer_cast<BinaryExpression>(shared_from_this());
17316  }
17317 
17318  /**
17319  * \brief Get std::shared_ptr from `this` pointer of the current ast node
17320  */
17321  std::shared_ptr<const Ast> get_shared_ptr() const override {
17322  return std::static_pointer_cast<const BinaryExpression>(shared_from_this());
17323  }
17324 
17325  /**
17326  * \brief Return associated token for the current ast node
17327  *
17328  * Not all ast nodes have token information. For example,
17329  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
17330  * solution of ODEs. In this case, we return nullptr to store in the
17331  * nmodl::symtab::SymbolTable.
17332  *
17333  * \return pointer to token if exist otherwise nullptr
17334  */
17335  const ModToken *get_token() const noexcept override { return token.get(); }
17336 
17337  /**
17338  * \brief Getter for member variable \ref BinaryExpression.lhs
17339  */
17340  const std::shared_ptr<Expression> &get_lhs() const noexcept { return lhs; }
17341 
17342  /**
17343  * \brief Getter for member variable \ref BinaryExpression.op
17344  */
17345  const BinaryOperator &get_op() const noexcept { return op; }
17346 
17347  /**
17348  * \brief Getter for member variable \ref BinaryExpression.rhs
17349  */
17350  const std::shared_ptr<Expression> &get_rhs() const noexcept { return rhs; }
17351 
17352  /// \}
17353 
17354  /// \name Setters
17355  /// \{
17356 
17357  /**
17358  * \brief Set token for the current ast node
17359  */
17360  void set_token(const ModToken &tok) {
17361  token = std::make_shared<ModToken>(tok);
17362  }
17363 
17364  /**
17365  * \brief Setter for member variable \ref BinaryExpression.lhs (rvalue
17366  * reference)
17367  */
17368  void set_lhs(std::shared_ptr<Expression> &&lhs);
17369 
17370  /**
17371  * \brief Setter for member variable \ref BinaryExpression.lhs
17372  */
17373  void set_lhs(const std::shared_ptr<Expression> &lhs);
17374 
17375  /**
17376  * \brief Setter for member variable \ref BinaryExpression.op (rvalue
17377  * reference)
17378  */
17379  void set_op(BinaryOperator &&op);
17380 
17381  /**
17382  * \brief Setter for member variable \ref BinaryExpression.op
17383  */
17384  void set_op(const BinaryOperator &op);
17385 
17386  /**
17387  * \brief Setter for member variable \ref BinaryExpression.rhs (rvalue
17388  * reference)
17389  */
17390  void set_rhs(std::shared_ptr<Expression> &&rhs);
17391 
17392  /**
17393  * \brief Setter for member variable \ref BinaryExpression.rhs
17394  */
17395  void set_rhs(const std::shared_ptr<Expression> &rhs);
17396 
17397  /// \}
17398 
17399  /// \name Visitor
17400  /// \{
17401 
17402  /**
17403  * \brief visit children i.e. member variables of current node using provided
17404  * visitor
17405  *
17406  * Different nodes in the AST have different members (i.e. children). This
17407  * method recursively visits children using provided visitor.
17408  *
17409  * \param v Concrete visitor that will be used to recursively visit children
17410  *
17411  * \sa Ast::visit_children for example.
17412  */
17413  void visit_children(visitor::Visitor &v) override;
17414 
17415  /**
17416  * \brief visit children i.e. member variables of current node using provided
17417  * visitor
17418  *
17419  * Different nodes in the AST have different members (i.e. children). This
17420  * method recursively visits children using provided visitor.
17421  *
17422  * \param v Concrete constant visitor that will be used to recursively visit
17423  * children
17424  *
17425  * \sa Ast::visit_children for example.
17426  */
17427  void visit_children(visitor::ConstVisitor &v) const override;
17428 
17429  /**
17430  * \brief accept (or visit) the current AST node using provided visitor
17431  *
17432  * Instead of visiting children of AST node, like Ast::visit_children,
17433  * accept allows to visit the current node itself using provided concrete
17434  * visitor.
17435  *
17436  * \param v Concrete visitor that will be used to recursively visit node
17437  *
17438  * \sa Ast::accept for example.
17439  */
17440  void accept(visitor::Visitor &v) override;
17441 
17442  /**
17443  * \copydoc accept(visitor::Visitor&)
17444  */
17445  void accept(visitor::ConstVisitor &v) const override;
17446 
17447  /// \}
17448 
17449 private:
17450  /**
17451  * \brief Set this object as parent for all the children
17452  *
17453  * This should be called in every object (with children) constructor
17454  * to set parents. Since it is called only in the constructors it
17455  * should not be virtual to avoid ambiguities (issue #295).
17456  */
17457  void set_parent_in_children();
17458 };
17459 
17460 /** @} */ // end of ast_class
17461 
17462 } // namespace ast
17463 } // namespace nmodl
17464 #endif // !NMODL_AST_BINARY_EXPRESSION_HPP
17465 #ifndef NMODL_AST_DIFF_EQ_EXPRESSION_HPP
17466 #define NMODL_AST_DIFF_EQ_EXPRESSION_HPP
17467 
17468 namespace nmodl {
17469 namespace ast {
17470 
17471 /**
17472  * @addtogroup ast_class
17473  * @ingroup ast
17474  * @{
17475  */
17476 
17477 /**
17478  * \brief Represents differential equation in DERIVATIVE block
17479  *
17480  *
17481  */
17483 private:
17484  /// Differential Expression
17485  std::shared_ptr<BinaryExpression> expression;
17486  /// token with location information
17487  std::shared_ptr<ModToken> token;
17488 
17489 public:
17490  /// \name Ctor & dtor
17491  /// \{
17492 
17493  explicit DiffEqExpression(BinaryExpression *expression);
17494  explicit DiffEqExpression(
17495  const std::shared_ptr<BinaryExpression> &expression);
17496  DiffEqExpression(const DiffEqExpression &obj);
17497 
17498  virtual ~DiffEqExpression() = default;
17499 
17500  /// \}
17501 
17502  /**
17503  * \brief Check if the ast node is an instance of ast::DiffEqExpression
17504  * \return true as object is of type ast::DiffEqExpression
17505  */
17506  bool is_diff_eq_expression() const noexcept override { return true; }
17507 
17508  /**
17509  * \brief Return a copy of the current node
17510  *
17511  * Recursively make a new copy/clone of the current node including
17512  * all members and return a pointer to the node. This is used for
17513  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
17514  * ast.
17515  *
17516  * @return pointer to the clone/copy of the current node
17517  */
17518  DiffEqExpression *clone() const override {
17519  return new DiffEqExpression(*this);
17520  }
17521 
17522  /// \name Getters
17523  /// \{
17524 
17525  /**
17526  * \brief Return type (ast::AstNodeType) of ast node
17527  *
17528  * Every node in the ast has a type defined in ast::AstNodeType and this
17529  * function is used to retrieve the same.
17530  *
17531  * \return ast node type i.e. ast::AstNodeType::DIFF_EQ_EXPRESSION
17532  *
17533  * \sa Ast::get_node_type_name
17534  */
17535  AstNodeType get_node_type() const noexcept override {
17537  }
17538 
17539  /**
17540  * \brief Return type (ast::AstNodeType) of ast node as std::string
17541  *
17542  * Every node in the ast has a type defined in ast::AstNodeType.
17543  * This type name can be returned as a std::string for printing
17544  * node to text/json form.
17545  *
17546  * \return name of the node type as a string i.e. "DiffEqExpression"
17547  *
17548  * \sa Ast::get_node_name
17549  */
17550  std::string get_node_type_name() const noexcept override {
17551  return "DiffEqExpression";
17552  }
17553 
17554  /**
17555  * \brief Get std::shared_ptr from `this` pointer of the current ast node
17556  */
17557  std::shared_ptr<Ast> get_shared_ptr() override {
17558  return std::static_pointer_cast<DiffEqExpression>(shared_from_this());
17559  }
17560 
17561  /**
17562  * \brief Get std::shared_ptr from `this` pointer of the current ast node
17563  */
17564  std::shared_ptr<const Ast> get_shared_ptr() const override {
17565  return std::static_pointer_cast<const DiffEqExpression>(shared_from_this());
17566  }
17567 
17568  /**
17569  * \brief Return associated token for the current ast node
17570  *
17571  * Not all ast nodes have token information. For example,
17572  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
17573  * solution of ODEs. In this case, we return nullptr to store in the
17574  * nmodl::symtab::SymbolTable.
17575  *
17576  * \return pointer to token if exist otherwise nullptr
17577  */
17578  const ModToken *get_token() const noexcept override { return token.get(); }
17579 
17580  /**
17581  * \brief Getter for member variable \ref DiffEqExpression.expression
17582  */
17583  const std::shared_ptr<BinaryExpression> &get_expression() const noexcept {
17584  return expression;
17585  }
17586 
17587  /// \}
17588 
17589  /// \name Setters
17590  /// \{
17591 
17592  /**
17593  * \brief Set token for the current ast node
17594  */
17595  void set_token(const ModToken &tok) {
17596  token = std::make_shared<ModToken>(tok);
17597  }
17598 
17599  /**
17600  * \brief Setter for member variable \ref DiffEqExpression.expression (rvalue
17601  * reference)
17602  */
17603  void set_expression(std::shared_ptr<BinaryExpression> &&expression);
17604 
17605  /**
17606  * \brief Setter for member variable \ref DiffEqExpression.expression
17607  */
17608  void set_expression(const std::shared_ptr<BinaryExpression> &expression);
17609 
17610  /// \}
17611 
17612  /// \name Visitor
17613  /// \{
17614 
17615  /**
17616  * \brief visit children i.e. member variables of current node using provided
17617  * visitor
17618  *
17619  * Different nodes in the AST have different members (i.e. children). This
17620  * method recursively visits children using provided visitor.
17621  *
17622  * \param v Concrete visitor that will be used to recursively visit children
17623  *
17624  * \sa Ast::visit_children for example.
17625  */
17626  void visit_children(visitor::Visitor &v) override;
17627 
17628  /**
17629  * \brief visit children i.e. member variables of current node using provided
17630  * visitor
17631  *
17632  * Different nodes in the AST have different members (i.e. children). This
17633  * method recursively visits children using provided visitor.
17634  *
17635  * \param v Concrete constant visitor that will be used to recursively visit
17636  * children
17637  *
17638  * \sa Ast::visit_children for example.
17639  */
17640  void visit_children(visitor::ConstVisitor &v) const override;
17641 
17642  /**
17643  * \brief accept (or visit) the current AST node using provided visitor
17644  *
17645  * Instead of visiting children of AST node, like Ast::visit_children,
17646  * accept allows to visit the current node itself using provided concrete
17647  * visitor.
17648  *
17649  * \param v Concrete visitor that will be used to recursively visit node
17650  *
17651  * \sa Ast::accept for example.
17652  */
17653  void accept(visitor::Visitor &v) override;
17654 
17655  /**
17656  * \copydoc accept(visitor::Visitor&)
17657  */
17658  void accept(visitor::ConstVisitor &v) const override;
17659 
17660  /// \}
17661 
17662 private:
17663  /**
17664  * \brief Set this object as parent for all the children
17665  *
17666  * This should be called in every object (with children) constructor
17667  * to set parents. Since it is called only in the constructors it
17668  * should not be virtual to avoid ambiguities (issue #295).
17669  */
17670  void set_parent_in_children();
17671 };
17672 
17673 /** @} */ // end of ast_class
17674 
17675 } // namespace ast
17676 } // namespace nmodl
17677 #endif // !NMODL_AST_DIFF_EQ_EXPRESSION_HPP
17678 #ifndef NMODL_AST_UNARY_EXPRESSION_HPP
17679 #define NMODL_AST_UNARY_EXPRESSION_HPP
17680 
17681 namespace nmodl {
17682 namespace ast {
17683 
17684 /**
17685  * @addtogroup ast_class
17686  * @ingroup ast
17687  * @{
17688  */
17689 
17690 /**
17691  * \brief TODO
17692  *
17693  *
17694  */
17695 class UnaryExpression : public Expression {
17696 private:
17697  /// TODO
17699  /// TODO
17700  std::shared_ptr<Expression> expression;
17701  /// token with location information
17702  std::shared_ptr<ModToken> token;
17703 
17704 public:
17705  /// \name Ctor & dtor
17706  /// \{
17707 
17708  explicit UnaryExpression(const UnaryOperator &op, Expression *expression);
17709  explicit UnaryExpression(const UnaryOperator &op,
17710  const std::shared_ptr<Expression> &expression);
17711  UnaryExpression(const UnaryExpression &obj);
17712 
17713  virtual ~UnaryExpression() = default;
17714 
17715  /// \}
17716 
17717  /**
17718  * \brief Check if the ast node is an instance of ast::UnaryExpression
17719  * \return true as object is of type ast::UnaryExpression
17720  */
17721  bool is_unary_expression() const noexcept override { return true; }
17722 
17723  /**
17724  * \brief Return a copy of the current node
17725  *
17726  * Recursively make a new copy/clone of the current node including
17727  * all members and return a pointer to the node. This is used for
17728  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
17729  * ast.
17730  *
17731  * @return pointer to the clone/copy of the current node
17732  */
17733  UnaryExpression *clone() const override { return new UnaryExpression(*this); }
17734 
17735  /// \name Getters
17736  /// \{
17737 
17738  /**
17739  * \brief Return type (ast::AstNodeType) of ast node
17740  *
17741  * Every node in the ast has a type defined in ast::AstNodeType and this
17742  * function is used to retrieve the same.
17743  *
17744  * \return ast node type i.e. ast::AstNodeType::UNARY_EXPRESSION
17745  *
17746  * \sa Ast::get_node_type_name
17747  */
17748  AstNodeType get_node_type() const noexcept override {
17750  }
17751 
17752  /**
17753  * \brief Return type (ast::AstNodeType) of ast node as std::string
17754  *
17755  * Every node in the ast has a type defined in ast::AstNodeType.
17756  * This type name can be returned as a std::string for printing
17757  * node to text/json form.
17758  *
17759  * \return name of the node type as a string i.e. "UnaryExpression"
17760  *
17761  * \sa Ast::get_node_name
17762  */
17763  std::string get_node_type_name() const noexcept override {
17764  return "UnaryExpression";
17765  }
17766 
17767  /**
17768  * \brief Get std::shared_ptr from `this` pointer of the current ast node
17769  */
17770  std::shared_ptr<Ast> get_shared_ptr() override {
17771  return std::static_pointer_cast<UnaryExpression>(shared_from_this());
17772  }
17773 
17774  /**
17775  * \brief Get std::shared_ptr from `this` pointer of the current ast node
17776  */
17777  std::shared_ptr<const Ast> get_shared_ptr() const override {
17778  return std::static_pointer_cast<const UnaryExpression>(shared_from_this());
17779  }
17780 
17781  /**
17782  * \brief Return associated token for the current ast node
17783  *
17784  * Not all ast nodes have token information. For example,
17785  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
17786  * solution of ODEs. In this case, we return nullptr to store in the
17787  * nmodl::symtab::SymbolTable.
17788  *
17789  * \return pointer to token if exist otherwise nullptr
17790  */
17791  const ModToken *get_token() const noexcept override { return token.get(); }
17792 
17793  /**
17794  * \brief Getter for member variable \ref UnaryExpression.op
17795  */
17796  const UnaryOperator &get_op() const noexcept { return op; }
17797 
17798  /**
17799  * \brief Getter for member variable \ref UnaryExpression.expression
17800  */
17801  const std::shared_ptr<Expression> &get_expression() const noexcept {
17802  return expression;
17803  }
17804 
17805  /// \}
17806 
17807  /// \name Setters
17808  /// \{
17809 
17810  /**
17811  * \brief Set token for the current ast node
17812  */
17813  void set_token(const ModToken &tok) {
17814  token = std::make_shared<ModToken>(tok);
17815  }
17816 
17817  /**
17818  * \brief Setter for member variable \ref UnaryExpression.op (rvalue
17819  * reference)
17820  */
17821  void set_op(UnaryOperator &&op);
17822 
17823  /**
17824  * \brief Setter for member variable \ref UnaryExpression.op
17825  */
17826  void set_op(const UnaryOperator &op);
17827 
17828  /**
17829  * \brief Setter for member variable \ref UnaryExpression.expression (rvalue
17830  * reference)
17831  */
17832  void set_expression(std::shared_ptr<Expression> &&expression);
17833 
17834  /**
17835  * \brief Setter for member variable \ref UnaryExpression.expression
17836  */
17837  void set_expression(const std::shared_ptr<Expression> &expression);
17838 
17839  /// \}
17840 
17841  /// \name Visitor
17842  /// \{
17843 
17844  /**
17845  * \brief visit children i.e. member variables of current node using provided
17846  * visitor
17847  *
17848  * Different nodes in the AST have different members (i.e. children). This
17849  * method recursively visits children using provided visitor.
17850  *
17851  * \param v Concrete visitor that will be used to recursively visit children
17852  *
17853  * \sa Ast::visit_children for example.
17854  */
17855  void visit_children(visitor::Visitor &v) override;
17856 
17857  /**
17858  * \brief visit children i.e. member variables of current node using provided
17859  * visitor
17860  *
17861  * Different nodes in the AST have different members (i.e. children). This
17862  * method recursively visits children using provided visitor.
17863  *
17864  * \param v Concrete constant visitor that will be used to recursively visit
17865  * children
17866  *
17867  * \sa Ast::visit_children for example.
17868  */
17869  void visit_children(visitor::ConstVisitor &v) const override;
17870 
17871  /**
17872  * \brief accept (or visit) the current AST node using provided visitor
17873  *
17874  * Instead of visiting children of AST node, like Ast::visit_children,
17875  * accept allows to visit the current node itself using provided concrete
17876  * visitor.
17877  *
17878  * \param v Concrete visitor that will be used to recursively visit node
17879  *
17880  * \sa Ast::accept for example.
17881  */
17882  void accept(visitor::Visitor &v) override;
17883 
17884  /**
17885  * \copydoc accept(visitor::Visitor&)
17886  */
17887  void accept(visitor::ConstVisitor &v) const override;
17888 
17889  /// \}
17890 
17891 private:
17892  /**
17893  * \brief Set this object as parent for all the children
17894  *
17895  * This should be called in every object (with children) constructor
17896  * to set parents. Since it is called only in the constructors it
17897  * should not be virtual to avoid ambiguities (issue #295).
17898  */
17899  void set_parent_in_children();
17900 };
17901 
17902 /** @} */ // end of ast_class
17903 
17904 } // namespace ast
17905 } // namespace nmodl
17906 #endif // !NMODL_AST_UNARY_EXPRESSION_HPP
17907 #ifndef NMODL_AST_NON_LIN_EQUATION_HPP
17908 #define NMODL_AST_NON_LIN_EQUATION_HPP
17909 
17910 namespace nmodl {
17911 namespace ast {
17912 
17913 /**
17914  * @addtogroup ast_class
17915  * @ingroup ast
17916  * @{
17917  */
17918 
17919 /**
17920  * \brief TODO
17921  *
17922  *
17923  */
17924 class NonLinEquation : public Expression {
17925 private:
17926  /// TODO
17927  std::shared_ptr<Expression> lhs;
17928  /// TODO
17929  std::shared_ptr<Expression> rhs;
17930  /// token with location information
17931  std::shared_ptr<ModToken> token;
17932 
17933 public:
17934  /// \name Ctor & dtor
17935  /// \{
17936 
17937  explicit NonLinEquation(Expression *lhs, Expression *rhs);
17938  explicit NonLinEquation(const std::shared_ptr<Expression> &lhs,
17939  const std::shared_ptr<Expression> &rhs);
17940  NonLinEquation(const NonLinEquation &obj);
17941 
17942  virtual ~NonLinEquation() = default;
17943 
17944  /// \}
17945 
17946  /**
17947  * \brief Check if the ast node is an instance of ast::NonLinEquation
17948  * \return true as object is of type ast::NonLinEquation
17949  */
17950  bool is_non_lin_equation() const noexcept override { return true; }
17951 
17952  /**
17953  * \brief Return a copy of the current node
17954  *
17955  * Recursively make a new copy/clone of the current node including
17956  * all members and return a pointer to the node. This is used for
17957  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
17958  * ast.
17959  *
17960  * @return pointer to the clone/copy of the current node
17961  */
17962  NonLinEquation *clone() const override { return new NonLinEquation(*this); }
17963 
17964  /// \name Getters
17965  /// \{
17966 
17967  /**
17968  * \brief Return type (ast::AstNodeType) of ast node
17969  *
17970  * Every node in the ast has a type defined in ast::AstNodeType and this
17971  * function is used to retrieve the same.
17972  *
17973  * \return ast node type i.e. ast::AstNodeType::NON_LIN_EQUATION
17974  *
17975  * \sa Ast::get_node_type_name
17976  */
17977  AstNodeType get_node_type() const noexcept override {
17979  }
17980 
17981  /**
17982  * \brief Return type (ast::AstNodeType) of ast node as std::string
17983  *
17984  * Every node in the ast has a type defined in ast::AstNodeType.
17985  * This type name can be returned as a std::string for printing
17986  * node to text/json form.
17987  *
17988  * \return name of the node type as a string i.e. "NonLinEquation"
17989  *
17990  * \sa Ast::get_node_name
17991  */
17992  std::string get_node_type_name() const noexcept override {
17993  return "NonLinEquation";
17994  }
17995 
17996  /**
17997  * \brief Return NMODL statement of ast node as std::string
17998  *
17999  * Every node is related to a special statement in the NMODL. This
18000  * statement can be returned as a std::string for printing to
18001  * text/json form.
18002  *
18003  * \return name of the statement as a string i.e. "~ "
18004  *
18005  * \sa Ast::get_nmodl_name
18006  */
18007  std::string get_nmodl_name() const noexcept override { return "~ "; }
18008 
18009  /**
18010  * \brief Get std::shared_ptr from `this` pointer of the current ast node
18011  */
18012  std::shared_ptr<Ast> get_shared_ptr() override {
18013  return std::static_pointer_cast<NonLinEquation>(shared_from_this());
18014  }
18015 
18016  /**
18017  * \brief Get std::shared_ptr from `this` pointer of the current ast node
18018  */
18019  std::shared_ptr<const Ast> get_shared_ptr() const override {
18020  return std::static_pointer_cast<const NonLinEquation>(shared_from_this());
18021  }
18022 
18023  /**
18024  * \brief Return associated token for the current ast node
18025  *
18026  * Not all ast nodes have token information. For example,
18027  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
18028  * solution of ODEs. In this case, we return nullptr to store in the
18029  * nmodl::symtab::SymbolTable.
18030  *
18031  * \return pointer to token if exist otherwise nullptr
18032  */
18033  const ModToken *get_token() const noexcept override { return token.get(); }
18034 
18035  /**
18036  * \brief Getter for member variable \ref NonLinEquation.lhs
18037  */
18038  const std::shared_ptr<Expression> &get_lhs() const noexcept { return lhs; }
18039 
18040  /**
18041  * \brief Getter for member variable \ref NonLinEquation.rhs
18042  */
18043  const std::shared_ptr<Expression> &get_rhs() const noexcept { return rhs; }
18044 
18045  /// \}
18046 
18047  /// \name Setters
18048  /// \{
18049 
18050  /**
18051  * \brief Set token for the current ast node
18052  */
18053  void set_token(const ModToken &tok) {
18054  token = std::make_shared<ModToken>(tok);
18055  }
18056 
18057  /**
18058  * \brief Setter for member variable \ref NonLinEquation.lhs (rvalue
18059  * reference)
18060  */
18061  void set_lhs(std::shared_ptr<Expression> &&lhs);
18062 
18063  /**
18064  * \brief Setter for member variable \ref NonLinEquation.lhs
18065  */
18066  void set_lhs(const std::shared_ptr<Expression> &lhs);
18067 
18068  /**
18069  * \brief Setter for member variable \ref NonLinEquation.rhs (rvalue
18070  * reference)
18071  */
18072  void set_rhs(std::shared_ptr<Expression> &&rhs);
18073 
18074  /**
18075  * \brief Setter for member variable \ref NonLinEquation.rhs
18076  */
18077  void set_rhs(const std::shared_ptr<Expression> &rhs);
18078 
18079  /// \}
18080 
18081  /// \name Visitor
18082  /// \{
18083 
18084  /**
18085  * \brief visit children i.e. member variables of current node using provided
18086  * visitor
18087  *
18088  * Different nodes in the AST have different members (i.e. children). This
18089  * method recursively visits children using provided visitor.
18090  *
18091  * \param v Concrete visitor that will be used to recursively visit children
18092  *
18093  * \sa Ast::visit_children for example.
18094  */
18095  void visit_children(visitor::Visitor &v) override;
18096 
18097  /**
18098  * \brief visit children i.e. member variables of current node using provided
18099  * visitor
18100  *
18101  * Different nodes in the AST have different members (i.e. children). This
18102  * method recursively visits children using provided visitor.
18103  *
18104  * \param v Concrete constant visitor that will be used to recursively visit
18105  * children
18106  *
18107  * \sa Ast::visit_children for example.
18108  */
18109  void visit_children(visitor::ConstVisitor &v) const override;
18110 
18111  /**
18112  * \brief accept (or visit) the current AST node using provided visitor
18113  *
18114  * Instead of visiting children of AST node, like Ast::visit_children,
18115  * accept allows to visit the current node itself using provided concrete
18116  * visitor.
18117  *
18118  * \param v Concrete visitor that will be used to recursively visit node
18119  *
18120  * \sa Ast::accept for example.
18121  */
18122  void accept(visitor::Visitor &v) override;
18123 
18124  /**
18125  * \copydoc accept(visitor::Visitor&)
18126  */
18127  void accept(visitor::ConstVisitor &v) const override;
18128 
18129  /// \}
18130 
18131 private:
18132  /**
18133  * \brief Set this object as parent for all the children
18134  *
18135  * This should be called in every object (with children) constructor
18136  * to set parents. Since it is called only in the constructors it
18137  * should not be virtual to avoid ambiguities (issue #295).
18138  */
18139  void set_parent_in_children();
18140 };
18141 
18142 /** @} */ // end of ast_class
18143 
18144 } // namespace ast
18145 } // namespace nmodl
18146 #endif // !NMODL_AST_NON_LIN_EQUATION_HPP
18147 #ifndef NMODL_AST_LIN_EQUATION_HPP
18148 #define NMODL_AST_LIN_EQUATION_HPP
18149 
18150 namespace nmodl {
18151 namespace ast {
18152 
18153 /**
18154  * @addtogroup ast_class
18155  * @ingroup ast
18156  * @{
18157  */
18158 
18159 /**
18160  * \brief TODO
18161  *
18162  *
18163  */
18164 class LinEquation : public Expression {
18165 private:
18166  /// TODO
18167  std::shared_ptr<Expression> left_linxpression;
18168  /// TODO
18169  std::shared_ptr<Expression> linxpression;
18170  /// token with location information
18171  std::shared_ptr<ModToken> token;
18172 
18173 public:
18174  /// \name Ctor & dtor
18175  /// \{
18176 
18177  explicit LinEquation(Expression *left_linxpression, Expression *linxpression);
18178  explicit LinEquation(const std::shared_ptr<Expression> &left_linxpression,
18179  const std::shared_ptr<Expression> &linxpression);
18180  LinEquation(const LinEquation &obj);
18181 
18182  virtual ~LinEquation() = default;
18183 
18184  /// \}
18185 
18186  /**
18187  * \brief Check if the ast node is an instance of ast::LinEquation
18188  * \return true as object is of type ast::LinEquation
18189  */
18190  bool is_lin_equation() const noexcept override { return true; }
18191 
18192  /**
18193  * \brief Return a copy of the current node
18194  *
18195  * Recursively make a new copy/clone of the current node including
18196  * all members and return a pointer to the node. This is used for
18197  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
18198  * ast.
18199  *
18200  * @return pointer to the clone/copy of the current node
18201  */
18202  LinEquation *clone() const override { return new LinEquation(*this); }
18203 
18204  /// \name Getters
18205  /// \{
18206 
18207  /**
18208  * \brief Return type (ast::AstNodeType) of ast node
18209  *
18210  * Every node in the ast has a type defined in ast::AstNodeType and this
18211  * function is used to retrieve the same.
18212  *
18213  * \return ast node type i.e. ast::AstNodeType::LIN_EQUATION
18214  *
18215  * \sa Ast::get_node_type_name
18216  */
18217  AstNodeType get_node_type() const noexcept override {
18219  }
18220 
18221  /**
18222  * \brief Return type (ast::AstNodeType) of ast node as std::string
18223  *
18224  * Every node in the ast has a type defined in ast::AstNodeType.
18225  * This type name can be returned as a std::string for printing
18226  * node to text/json form.
18227  *
18228  * \return name of the node type as a string i.e. "LinEquation"
18229  *
18230  * \sa Ast::get_node_name
18231  */
18232  std::string get_node_type_name() const noexcept override {
18233  return "LinEquation";
18234  }
18235 
18236  /**
18237  * \brief Return NMODL statement of ast node as std::string
18238  *
18239  * Every node is related to a special statement in the NMODL. This
18240  * statement can be returned as a std::string for printing to
18241  * text/json form.
18242  *
18243  * \return name of the statement as a string i.e. "~ "
18244  *
18245  * \sa Ast::get_nmodl_name
18246  */
18247  std::string get_nmodl_name() const noexcept override { return "~ "; }
18248 
18249  /**
18250  * \brief Get std::shared_ptr from `this` pointer of the current ast node
18251  */
18252  std::shared_ptr<Ast> get_shared_ptr() override {
18253  return std::static_pointer_cast<LinEquation>(shared_from_this());
18254  }
18255 
18256  /**
18257  * \brief Get std::shared_ptr from `this` pointer of the current ast node
18258  */
18259  std::shared_ptr<const Ast> get_shared_ptr() const override {
18260  return std::static_pointer_cast<const LinEquation>(shared_from_this());
18261  }
18262 
18263  /**
18264  * \brief Return associated token for the current ast node
18265  *
18266  * Not all ast nodes have token information. For example,
18267  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
18268  * solution of ODEs. In this case, we return nullptr to store in the
18269  * nmodl::symtab::SymbolTable.
18270  *
18271  * \return pointer to token if exist otherwise nullptr
18272  */
18273  const ModToken *get_token() const noexcept override { return token.get(); }
18274 
18275  /**
18276  * \brief Getter for member variable \ref LinEquation.left_linxpression
18277  */
18278  const std::shared_ptr<Expression> &get_left_linxpression() const noexcept {
18279  return left_linxpression;
18280  }
18281 
18282  /**
18283  * \brief Getter for member variable \ref LinEquation.linxpression
18284  */
18285  const std::shared_ptr<Expression> &get_linxpression() const noexcept {
18286  return linxpression;
18287  }
18288 
18289  /// \}
18290 
18291  /// \name Setters
18292  /// \{
18293 
18294  /**
18295  * \brief Set token for the current ast node
18296  */
18297  void set_token(const ModToken &tok) {
18298  token = std::make_shared<ModToken>(tok);
18299  }
18300 
18301  /**
18302  * \brief Setter for member variable \ref LinEquation.left_linxpression
18303  * (rvalue reference)
18304  */
18305  void set_left_linxpression(std::shared_ptr<Expression> &&left_linxpression);
18306 
18307  /**
18308  * \brief Setter for member variable \ref LinEquation.left_linxpression
18309  */
18310  void
18311  set_left_linxpression(const std::shared_ptr<Expression> &left_linxpression);
18312 
18313  /**
18314  * \brief Setter for member variable \ref LinEquation.linxpression (rvalue
18315  * reference)
18316  */
18317  void set_linxpression(std::shared_ptr<Expression> &&linxpression);
18318 
18319  /**
18320  * \brief Setter for member variable \ref LinEquation.linxpression
18321  */
18322  void set_linxpression(const std::shared_ptr<Expression> &linxpression);
18323 
18324  /// \}
18325 
18326  /// \name Visitor
18327  /// \{
18328 
18329  /**
18330  * \brief visit children i.e. member variables of current node using provided
18331  * visitor
18332  *
18333  * Different nodes in the AST have different members (i.e. children). This
18334  * method recursively visits children using provided visitor.
18335  *
18336  * \param v Concrete visitor that will be used to recursively visit children
18337  *
18338  * \sa Ast::visit_children for example.
18339  */
18340  void visit_children(visitor::Visitor &v) override;
18341 
18342  /**
18343  * \brief visit children i.e. member variables of current node using provided
18344  * visitor
18345  *
18346  * Different nodes in the AST have different members (i.e. children). This
18347  * method recursively visits children using provided visitor.
18348  *
18349  * \param v Concrete constant visitor that will be used to recursively visit
18350  * children
18351  *
18352  * \sa Ast::visit_children for example.
18353  */
18354  void visit_children(visitor::ConstVisitor &v) const override;
18355 
18356  /**
18357  * \brief accept (or visit) the current AST node using provided visitor
18358  *
18359  * Instead of visiting children of AST node, like Ast::visit_children,
18360  * accept allows to visit the current node itself using provided concrete
18361  * visitor.
18362  *
18363  * \param v Concrete visitor that will be used to recursively visit node
18364  *
18365  * \sa Ast::accept for example.
18366  */
18367  void accept(visitor::Visitor &v) override;
18368 
18369  /**
18370  * \copydoc accept(visitor::Visitor&)
18371  */
18372  void accept(visitor::ConstVisitor &v) const override;
18373 
18374  /// \}
18375 
18376 private:
18377  /**
18378  * \brief Set this object as parent for all the children
18379  *
18380  * This should be called in every object (with children) constructor
18381  * to set parents. Since it is called only in the constructors it
18382  * should not be virtual to avoid ambiguities (issue #295).
18383  */
18384  void set_parent_in_children();
18385 };
18386 
18387 /** @} */ // end of ast_class
18388 
18389 } // namespace ast
18390 } // namespace nmodl
18391 #endif // !NMODL_AST_LIN_EQUATION_HPP
18392 #ifndef NMODL_AST_FUNCTION_CALL_HPP
18393 #define NMODL_AST_FUNCTION_CALL_HPP
18394 
18395 namespace nmodl {
18396 namespace ast {
18397 
18398 /**
18399  * @addtogroup ast_class
18400  * @ingroup ast
18401  * @{
18402  */
18403 
18404 /**
18405  * \brief TODO
18406  *
18407  *
18408  */
18409 class FunctionCall : public Expression {
18410 private:
18411  /// TODO
18412  std::shared_ptr<Name> name;
18413  /// TODO
18415  /// token with location information
18416  std::shared_ptr<ModToken> token;
18417 
18418 public:
18419  /// \name Ctor & dtor
18420  /// \{
18421 
18422  explicit FunctionCall(Name *name, ExpressionVector arguments);
18423  explicit FunctionCall(const std::shared_ptr<Name> &name,
18424  const ExpressionVector &arguments);
18425  FunctionCall(const FunctionCall &obj);
18426 
18427  virtual ~FunctionCall() = default;
18428 
18429  /// \}
18430 
18431  /**
18432  * \brief Check if the ast node is an instance of ast::FunctionCall
18433  * \return true as object is of type ast::FunctionCall
18434  */
18435  bool is_function_call() const noexcept override { return true; }
18436 
18437  /**
18438  * \brief Return a copy of the current node
18439  *
18440  * Recursively make a new copy/clone of the current node including
18441  * all members and return a pointer to the node. This is used for
18442  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
18443  * ast.
18444  *
18445  * @return pointer to the clone/copy of the current node
18446  */
18447  FunctionCall *clone() const override { return new FunctionCall(*this); }
18448 
18449  /// \name Getters
18450  /// \{
18451 
18452  /**
18453  * \brief Return type (ast::AstNodeType) of ast node
18454  *
18455  * Every node in the ast has a type defined in ast::AstNodeType and this
18456  * function is used to retrieve the same.
18457  *
18458  * \return ast node type i.e. ast::AstNodeType::FUNCTION_CALL
18459  *
18460  * \sa Ast::get_node_type_name
18461  */
18462  AstNodeType get_node_type() const noexcept override {
18464  }
18465 
18466  /**
18467  * \brief Return type (ast::AstNodeType) of ast node as std::string
18468  *
18469  * Every node in the ast has a type defined in ast::AstNodeType.
18470  * This type name can be returned as a std::string for printing
18471  * node to text/json form.
18472  *
18473  * \return name of the node type as a string i.e. "FunctionCall"
18474  *
18475  * \sa Ast::get_node_name
18476  */
18477  std::string get_node_type_name() const noexcept override {
18478  return "FunctionCall";
18479  }
18480 
18481  /**
18482  * \brief Get std::shared_ptr from `this` pointer of the current ast node
18483  */
18484  std::shared_ptr<Ast> get_shared_ptr() override {
18485  return std::static_pointer_cast<FunctionCall>(shared_from_this());
18486  }
18487 
18488  /**
18489  * \brief Get std::shared_ptr from `this` pointer of the current ast node
18490  */
18491  std::shared_ptr<const Ast> get_shared_ptr() const override {
18492  return std::static_pointer_cast<const FunctionCall>(shared_from_this());
18493  }
18494 
18495  /**
18496  * \brief Return associated token for the current ast node
18497  *
18498  * Not all ast nodes have token information. For example,
18499  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
18500  * solution of ODEs. In this case, we return nullptr to store in the
18501  * nmodl::symtab::SymbolTable.
18502  *
18503  * \return pointer to token if exist otherwise nullptr
18504  */
18505  const ModToken *get_token() const noexcept override { return token.get(); }
18506 
18507  /**
18508  * \brief Return name of the node
18509  *
18510  * Some ast nodes have a member marked designated as node name. For example,
18511  * in case of this ast::Name has name designated as a
18512  * node name.
18513  *
18514  * @return name of the node as std::string
18515  *
18516  * \sa Ast::get_node_type_name
18517  */
18518  std::string get_node_name() const override;
18519 
18520  /**
18521  * \brief Getter for member variable \ref FunctionCall.name
18522  */
18523  const std::shared_ptr<Name> &get_name() const noexcept { return name; }
18524 
18525  /**
18526  * \brief Getter for member variable \ref FunctionCall.arguments
18527  */
18528  const ExpressionVector &get_arguments() const noexcept { return arguments; }
18529 
18530  /// \}
18531 
18532  /// \name Setters
18533  /// \{
18534 
18535  /**
18536  * \brief Set token for the current ast node
18537  */
18538  void set_token(const ModToken &tok) {
18539  token = std::make_shared<ModToken>(tok);
18540  }
18541 
18542  /**
18543  * \brief Setter for member variable \ref FunctionCall.name (rvalue reference)
18544  */
18545  void set_name(std::shared_ptr<Name> &&name);
18546 
18547  /**
18548  * \brief Setter for member variable \ref FunctionCall.name
18549  */
18550  void set_name(const std::shared_ptr<Name> &name);
18551 
18552  /**
18553  * \brief Setter for member variable \ref FunctionCall.arguments (rvalue
18554  * reference)
18555  */
18556  void set_arguments(ExpressionVector &&arguments);
18557 
18558  /**
18559  * \brief Setter for member variable \ref FunctionCall.arguments
18560  */
18561  void set_arguments(const ExpressionVector &arguments);
18562 
18563  /// \}
18564 
18565  /// \name Visitor
18566  /// \{
18567 
18568  /**
18569  * \brief visit children i.e. member variables of current node using provided
18570  * visitor
18571  *
18572  * Different nodes in the AST have different members (i.e. children). This
18573  * method recursively visits children using provided visitor.
18574  *
18575  * \param v Concrete visitor that will be used to recursively visit children
18576  *
18577  * \sa Ast::visit_children for example.
18578  */
18579  void visit_children(visitor::Visitor &v) override;
18580 
18581  /**
18582  * \brief visit children i.e. member variables of current node using provided
18583  * visitor
18584  *
18585  * Different nodes in the AST have different members (i.e. children). This
18586  * method recursively visits children using provided visitor.
18587  *
18588  * \param v Concrete constant visitor that will be used to recursively visit
18589  * children
18590  *
18591  * \sa Ast::visit_children for example.
18592  */
18593  void visit_children(visitor::ConstVisitor &v) const override;
18594 
18595  /**
18596  * \brief accept (or visit) the current AST node using provided visitor
18597  *
18598  * Instead of visiting children of AST node, like Ast::visit_children,
18599  * accept allows to visit the current node itself using provided concrete
18600  * visitor.
18601  *
18602  * \param v Concrete visitor that will be used to recursively visit node
18603  *
18604  * \sa Ast::accept for example.
18605  */
18606  void accept(visitor::Visitor &v) override;
18607 
18608  /**
18609  * \copydoc accept(visitor::Visitor&)
18610  */
18611  void accept(visitor::ConstVisitor &v) const override;
18612 
18613  /// \}
18614 
18615 private:
18616  /**
18617  * \brief Set this object as parent for all the children
18618  *
18619  * This should be called in every object (with children) constructor
18620  * to set parents. Since it is called only in the constructors it
18621  * should not be virtual to avoid ambiguities (issue #295).
18622  */
18623  void set_parent_in_children();
18624 };
18625 
18626 /** @} */ // end of ast_class
18627 
18628 } // namespace ast
18629 } // namespace nmodl
18630 #endif // !NMODL_AST_FUNCTION_CALL_HPP
18631 #ifndef NMODL_AST_FIRST_LAST_TYPE_INDEX_HPP
18632 #define NMODL_AST_FIRST_LAST_TYPE_INDEX_HPP
18633 
18634 namespace nmodl {
18635 namespace ast {
18636 
18637 /**
18638  * @addtogroup ast_class
18639  * @ingroup ast
18640  * @{
18641  */
18642 
18643 /**
18644  * \brief TODO
18645  *
18646  *
18647  */
18649 private:
18650  /// TODO
18652  /// token with location information
18653  std::shared_ptr<ModToken> token;
18654 
18655 public:
18656  /// \name Ctor & dtor
18657  /// \{
18658 
18659  explicit FirstLastTypeIndex(FirstLastType value);
18661 
18662  virtual ~FirstLastTypeIndex() = default;
18663 
18664  /// \}
18665 
18666  /**
18667  * \brief Check if the ast node is an instance of ast::FirstLastTypeIndex
18668  * \return true as object is of type ast::FirstLastTypeIndex
18669  */
18670  bool is_first_last_type_index() const noexcept override { return true; }
18671 
18672  /**
18673  * \brief Return a copy of the current node
18674  *
18675  * Recursively make a new copy/clone of the current node including
18676  * all members and return a pointer to the node. This is used for
18677  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
18678  * ast.
18679  *
18680  * @return pointer to the clone/copy of the current node
18681  */
18682  FirstLastTypeIndex *clone() const override {
18683  return new FirstLastTypeIndex(*this);
18684  }
18685 
18686  /// \name Getters
18687  /// \{
18688 
18689  /**
18690  * \brief Return type (ast::AstNodeType) of ast node
18691  *
18692  * Every node in the ast has a type defined in ast::AstNodeType and this
18693  * function is used to retrieve the same.
18694  *
18695  * \return ast node type i.e. ast::AstNodeType::FIRST_LAST_TYPE_INDEX
18696  *
18697  * \sa Ast::get_node_type_name
18698  */
18699  AstNodeType get_node_type() const noexcept override {
18701  }
18702 
18703  /**
18704  * \brief Return type (ast::AstNodeType) of ast node as std::string
18705  *
18706  * Every node in the ast has a type defined in ast::AstNodeType.
18707  * This type name can be returned as a std::string for printing
18708  * node to text/json form.
18709  *
18710  * \return name of the node type as a string i.e. "FirstLastTypeIndex"
18711  *
18712  * \sa Ast::get_node_name
18713  */
18714  std::string get_node_type_name() const noexcept override {
18715  return "FirstLastTypeIndex";
18716  }
18717 
18718  /**
18719  * \brief Get std::shared_ptr from `this` pointer of the current ast node
18720  */
18721  std::shared_ptr<Ast> get_shared_ptr() override {
18722  return std::static_pointer_cast<FirstLastTypeIndex>(shared_from_this());
18723  }
18724 
18725  /**
18726  * \brief Get std::shared_ptr from `this` pointer of the current ast node
18727  */
18728  std::shared_ptr<const Ast> get_shared_ptr() const override {
18729  return std::static_pointer_cast<const FirstLastTypeIndex>(
18730  shared_from_this());
18731  }
18732 
18733  /**
18734  * \brief Return associated token for the current ast node
18735  *
18736  * Not all ast nodes have token information. For example,
18737  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
18738  * solution of ODEs. In this case, we return nullptr to store in the
18739  * nmodl::symtab::SymbolTable.
18740  *
18741  * \return pointer to token if exist otherwise nullptr
18742  */
18743  const ModToken *get_token() const noexcept override { return token.get(); }
18744 
18745  /**
18746  * \brief Getter for member variable \ref FirstLastTypeIndex.value
18747  */
18748  FirstLastType get_value() const noexcept { return value; }
18749 
18750  /// \}
18751 
18752  /// \name Setters
18753  /// \{
18754 
18755  /**
18756  * \brief Set token for the current ast node
18757  */
18758  void set_token(const ModToken &tok) {
18759  token = std::make_shared<ModToken>(tok);
18760  }
18761 
18762  /**
18763  * \brief Setter for member variable \ref FirstLastTypeIndex.value
18764  */
18765  void set_value(FirstLastType value);
18766 
18767  /// \}
18768 
18769  /// \name Visitor
18770  /// \{
18771 
18772  /**
18773  * \brief visit children i.e. member variables of current node using provided
18774  * visitor
18775  *
18776  * Different nodes in the AST have different members (i.e. children). This
18777  * method recursively visits children using provided visitor.
18778  *
18779  * \param v Concrete visitor that will be used to recursively visit children
18780  *
18781  * \sa Ast::visit_children for example.
18782  */
18783  void visit_children(visitor::Visitor &v) override;
18784 
18785  /**
18786  * \brief visit children i.e. member variables of current node using provided
18787  * visitor
18788  *
18789  * Different nodes in the AST have different members (i.e. children). This
18790  * method recursively visits children using provided visitor.
18791  *
18792  * \param v Concrete constant visitor that will be used to recursively visit
18793  * children
18794  *
18795  * \sa Ast::visit_children for example.
18796  */
18797  void visit_children(visitor::ConstVisitor &v) const override;
18798 
18799  /**
18800  * \brief accept (or visit) the current AST node using provided visitor
18801  *
18802  * Instead of visiting children of AST node, like Ast::visit_children,
18803  * accept allows to visit the current node itself using provided concrete
18804  * visitor.
18805  *
18806  * \param v Concrete visitor that will be used to recursively visit node
18807  *
18808  * \sa Ast::accept for example.
18809  */
18810  void accept(visitor::Visitor &v) override;
18811 
18812  /**
18813  * \copydoc accept(visitor::Visitor&)
18814  */
18815  void accept(visitor::ConstVisitor &v) const override;
18816 
18817  /// \}
18818 
18819  /**
18820  * \brief Return enum value in string form
18821  *
18822  * Enum variables (e.g. ast::BinaryOp, ast::UnitStateType) have
18823  * string representation when they are converted from AST back to
18824  * NMODL. This method is used to return corresponding string representation.
18825  */
18826  std::string eval() const { return FirstLastTypeNames[value]; }
18827 
18828 private:
18829  /**
18830  * \brief Set this object as parent for all the children
18831  *
18832  * This should be called in every object (with children) constructor
18833  * to set parents. Since it is called only in the constructors it
18834  * should not be virtual to avoid ambiguities (issue #295).
18835  */
18836  void set_parent_in_children();
18837 };
18838 
18839 /** @} */ // end of ast_class
18840 
18841 } // namespace ast
18842 } // namespace nmodl
18843 #endif // !NMODL_AST_FIRST_LAST_TYPE_INDEX_HPP
18844 #ifndef NMODL_AST_WATCH_HPP
18845 #define NMODL_AST_WATCH_HPP
18846 
18847 namespace nmodl {
18848 namespace ast {
18849 
18850 /**
18851  * @addtogroup ast_class
18852  * @ingroup ast
18853  * @{
18854  */
18855 
18856 /**
18857  * \brief TODO
18858  *
18859  *
18860  */
18861 class Watch : public Expression {
18862 private:
18863  /// TODO
18864  std::shared_ptr<Expression> expression;
18865  /// TODO
18866  std::shared_ptr<Expression> value;
18867  /// token with location information
18868  std::shared_ptr<ModToken> token;
18869 
18870 public:
18871  /// \name Ctor & dtor
18872  /// \{
18873 
18874  explicit Watch(Expression *expression, Expression *value);
18875  explicit Watch(const std::shared_ptr<Expression> &expression,
18876  const std::shared_ptr<Expression> &value);
18877  Watch(const Watch &obj);
18878 
18879  virtual ~Watch() = default;
18880 
18881  /// \}
18882 
18883  /**
18884  * \brief Check if the ast node is an instance of ast::Watch
18885  * \return true as object is of type ast::Watch
18886  */
18887  bool is_watch() const noexcept override { return true; }
18888 
18889  /**
18890  * \brief Return a copy of the current node
18891  *
18892  * Recursively make a new copy/clone of the current node including
18893  * all members and return a pointer to the node. This is used for
18894  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
18895  * ast.
18896  *
18897  * @return pointer to the clone/copy of the current node
18898  */
18899  Watch *clone() const override { return new Watch(*this); }
18900 
18901  /// \name Getters
18902  /// \{
18903 
18904  /**
18905  * \brief Return type (ast::AstNodeType) of ast node
18906  *
18907  * Every node in the ast has a type defined in ast::AstNodeType and this
18908  * function is used to retrieve the same.
18909  *
18910  * \return ast node type i.e. ast::AstNodeType::WATCH
18911  *
18912  * \sa Ast::get_node_type_name
18913  */
18914  AstNodeType get_node_type() const noexcept override {
18915  return AstNodeType::WATCH;
18916  }
18917 
18918  /**
18919  * \brief Return type (ast::AstNodeType) of ast node as std::string
18920  *
18921  * Every node in the ast has a type defined in ast::AstNodeType.
18922  * This type name can be returned as a std::string for printing
18923  * node to text/json form.
18924  *
18925  * \return name of the node type as a string i.e. "Watch"
18926  *
18927  * \sa Ast::get_node_name
18928  */
18929  std::string get_node_type_name() const noexcept override { return "Watch"; }
18930 
18931  /**
18932  * \brief Get std::shared_ptr from `this` pointer of the current ast node
18933  */
18934  std::shared_ptr<Ast> get_shared_ptr() override {
18935  return std::static_pointer_cast<Watch>(shared_from_this());
18936  }
18937 
18938  /**
18939  * \brief Get std::shared_ptr from `this` pointer of the current ast node
18940  */
18941  std::shared_ptr<const Ast> get_shared_ptr() const override {
18942  return std::static_pointer_cast<const Watch>(shared_from_this());
18943  }
18944 
18945  /**
18946  * \brief Return associated token for the current ast node
18947  *
18948  * Not all ast nodes have token information. For example,
18949  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
18950  * solution of ODEs. In this case, we return nullptr to store in the
18951  * nmodl::symtab::SymbolTable.
18952  *
18953  * \return pointer to token if exist otherwise nullptr
18954  */
18955  const ModToken *get_token() const noexcept override { return token.get(); }
18956 
18957  /**
18958  * \brief Getter for member variable \ref Watch.expression
18959  */
18960  const std::shared_ptr<Expression> &get_expression() const noexcept {
18961  return expression;
18962  }
18963 
18964  /**
18965  * \brief Getter for member variable \ref Watch.value
18966  */
18967  const std::shared_ptr<Expression> &get_value() const noexcept {
18968  return value;
18969  }
18970 
18971  /// \}
18972 
18973  /// \name Setters
18974  /// \{
18975 
18976  /**
18977  * \brief Set token for the current ast node
18978  */
18979  void set_token(const ModToken &tok) {
18980  token = std::make_shared<ModToken>(tok);
18981  }
18982 
18983  /**
18984  * \brief Setter for member variable \ref Watch.expression (rvalue reference)
18985  */
18986  void set_expression(std::shared_ptr<Expression> &&expression);
18987 
18988  /**
18989  * \brief Setter for member variable \ref Watch.expression
18990  */
18991  void set_expression(const std::shared_ptr<Expression> &expression);
18992 
18993  /**
18994  * \brief Setter for member variable \ref Watch.value (rvalue reference)
18995  */
18996  void set_value(std::shared_ptr<Expression> &&value);
18997 
18998  /**
18999  * \brief Setter for member variable \ref Watch.value
19000  */
19001  void set_value(const std::shared_ptr<Expression> &value);
19002 
19003  /// \}
19004 
19005  /// \name Visitor
19006  /// \{
19007 
19008  /**
19009  * \brief visit children i.e. member variables of current node using provided
19010  * visitor
19011  *
19012  * Different nodes in the AST have different members (i.e. children). This
19013  * method recursively visits children using provided visitor.
19014  *
19015  * \param v Concrete visitor that will be used to recursively visit children
19016  *
19017  * \sa Ast::visit_children for example.
19018  */
19019  void visit_children(visitor::Visitor &v) override;
19020 
19021  /**
19022  * \brief visit children i.e. member variables of current node using provided
19023  * visitor
19024  *
19025  * Different nodes in the AST have different members (i.e. children). This
19026  * method recursively visits children using provided visitor.
19027  *
19028  * \param v Concrete constant visitor that will be used to recursively visit
19029  * children
19030  *
19031  * \sa Ast::visit_children for example.
19032  */
19033  void visit_children(visitor::ConstVisitor &v) const override;
19034 
19035  /**
19036  * \brief accept (or visit) the current AST node using provided visitor
19037  *
19038  * Instead of visiting children of AST node, like Ast::visit_children,
19039  * accept allows to visit the current node itself using provided concrete
19040  * visitor.
19041  *
19042  * \param v Concrete visitor that will be used to recursively visit node
19043  *
19044  * \sa Ast::accept for example.
19045  */
19046  void accept(visitor::Visitor &v) override;
19047 
19048  /**
19049  * \copydoc accept(visitor::Visitor&)
19050  */
19051  void accept(visitor::ConstVisitor &v) const override;
19052 
19053  /// \}
19054 
19055 private:
19056  /**
19057  * \brief Set this object as parent for all the children
19058  *
19059  * This should be called in every object (with children) constructor
19060  * to set parents. Since it is called only in the constructors it
19061  * should not be virtual to avoid ambiguities (issue #295).
19062  */
19063  void set_parent_in_children();
19064 };
19065 
19066 /** @} */ // end of ast_class
19067 
19068 } // namespace ast
19069 } // namespace nmodl
19070 #endif // !NMODL_AST_WATCH_HPP
19071 #ifndef NMODL_AST_QUEUE_EXPRESSION_TYPE_HPP
19072 #define NMODL_AST_QUEUE_EXPRESSION_TYPE_HPP
19073 
19074 namespace nmodl {
19075 namespace ast {
19076 
19077 /**
19078  * @addtogroup ast_class
19079  * @ingroup ast
19080  * @{
19081  */
19082 
19083 /**
19084  * \brief TODO
19085  *
19086  *
19087  */
19089 private:
19090  /// TODO
19092  /// token with location information
19093  std::shared_ptr<ModToken> token;
19094 
19095 public:
19096  /// \name Ctor & dtor
19097  /// \{
19098 
19099  explicit QueueExpressionType(QueueType value);
19101 
19102  virtual ~QueueExpressionType() = default;
19103 
19104  /// \}
19105 
19106  /**
19107  * \brief Check if the ast node is an instance of ast::QueueExpressionType
19108  * \return true as object is of type ast::QueueExpressionType
19109  */
19110  bool is_queue_expression_type() const noexcept override { return true; }
19111 
19112  /**
19113  * \brief Return a copy of the current node
19114  *
19115  * Recursively make a new copy/clone of the current node including
19116  * all members and return a pointer to the node. This is used for
19117  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
19118  * ast.
19119  *
19120  * @return pointer to the clone/copy of the current node
19121  */
19122  QueueExpressionType *clone() const override {
19123  return new QueueExpressionType(*this);
19124  }
19125 
19126  /// \name Getters
19127  /// \{
19128 
19129  /**
19130  * \brief Return type (ast::AstNodeType) of ast node
19131  *
19132  * Every node in the ast has a type defined in ast::AstNodeType and this
19133  * function is used to retrieve the same.
19134  *
19135  * \return ast node type i.e. ast::AstNodeType::QUEUE_EXPRESSION_TYPE
19136  *
19137  * \sa Ast::get_node_type_name
19138  */
19139  AstNodeType get_node_type() const noexcept override {
19141  }
19142 
19143  /**
19144  * \brief Return type (ast::AstNodeType) of ast node as std::string
19145  *
19146  * Every node in the ast has a type defined in ast::AstNodeType.
19147  * This type name can be returned as a std::string for printing
19148  * node to text/json form.
19149  *
19150  * \return name of the node type as a string i.e. "QueueExpressionType"
19151  *
19152  * \sa Ast::get_node_name
19153  */
19154  std::string get_node_type_name() const noexcept override {
19155  return "QueueExpressionType";
19156  }
19157 
19158  /**
19159  * \brief Get std::shared_ptr from `this` pointer of the current ast node
19160  */
19161  std::shared_ptr<Ast> get_shared_ptr() override {
19162  return std::static_pointer_cast<QueueExpressionType>(shared_from_this());
19163  }
19164 
19165  /**
19166  * \brief Get std::shared_ptr from `this` pointer of the current ast node
19167  */
19168  std::shared_ptr<const Ast> get_shared_ptr() const override {
19169  return std::static_pointer_cast<const QueueExpressionType>(
19170  shared_from_this());
19171  }
19172 
19173  /**
19174  * \brief Return associated token for the current ast node
19175  *
19176  * Not all ast nodes have token information. For example,
19177  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
19178  * solution of ODEs. In this case, we return nullptr to store in the
19179  * nmodl::symtab::SymbolTable.
19180  *
19181  * \return pointer to token if exist otherwise nullptr
19182  */
19183  const ModToken *get_token() const noexcept override { return token.get(); }
19184 
19185  /**
19186  * \brief Getter for member variable \ref QueueExpressionType.value
19187  */
19188  QueueType get_value() const noexcept { return value; }
19189 
19190  /// \}
19191 
19192  /// \name Setters
19193  /// \{
19194 
19195  /**
19196  * \brief Set token for the current ast node
19197  */
19198  void set_token(const ModToken &tok) {
19199  token = std::make_shared<ModToken>(tok);
19200  }
19201 
19202  /**
19203  * \brief Setter for member variable \ref QueueExpressionType.value
19204  */
19205  void set_value(QueueType value);
19206 
19207  /// \}
19208 
19209  /// \name Visitor
19210  /// \{
19211 
19212  /**
19213  * \brief visit children i.e. member variables of current node using provided
19214  * visitor
19215  *
19216  * Different nodes in the AST have different members (i.e. children). This
19217  * method recursively visits children using provided visitor.
19218  *
19219  * \param v Concrete visitor that will be used to recursively visit children
19220  *
19221  * \sa Ast::visit_children for example.
19222  */
19223  void visit_children(visitor::Visitor &v) override;
19224 
19225  /**
19226  * \brief visit children i.e. member variables of current node using provided
19227  * visitor
19228  *
19229  * Different nodes in the AST have different members (i.e. children). This
19230  * method recursively visits children using provided visitor.
19231  *
19232  * \param v Concrete constant visitor that will be used to recursively visit
19233  * children
19234  *
19235  * \sa Ast::visit_children for example.
19236  */
19237  void visit_children(visitor::ConstVisitor &v) const override;
19238 
19239  /**
19240  * \brief accept (or visit) the current AST node using provided visitor
19241  *
19242  * Instead of visiting children of AST node, like Ast::visit_children,
19243  * accept allows to visit the current node itself using provided concrete
19244  * visitor.
19245  *
19246  * \param v Concrete visitor that will be used to recursively visit node
19247  *
19248  * \sa Ast::accept for example.
19249  */
19250  void accept(visitor::Visitor &v) override;
19251 
19252  /**
19253  * \copydoc accept(visitor::Visitor&)
19254  */
19255  void accept(visitor::ConstVisitor &v) const override;
19256 
19257  /// \}
19258 
19259  /**
19260  * \brief Return enum value in string form
19261  *
19262  * Enum variables (e.g. ast::BinaryOp, ast::UnitStateType) have
19263  * string representation when they are converted from AST back to
19264  * NMODL. This method is used to return corresponding string representation.
19265  */
19266  std::string eval() const { return QueueTypeNames[value]; }
19267 
19268 private:
19269  /**
19270  * \brief Set this object as parent for all the children
19271  *
19272  * This should be called in every object (with children) constructor
19273  * to set parents. Since it is called only in the constructors it
19274  * should not be virtual to avoid ambiguities (issue #295).
19275  */
19276  void set_parent_in_children();
19277 };
19278 
19279 /** @} */ // end of ast_class
19280 
19281 } // namespace ast
19282 } // namespace nmodl
19283 #endif // !NMODL_AST_QUEUE_EXPRESSION_TYPE_HPP
19284 #ifndef NMODL_AST_MATCH_HPP
19285 #define NMODL_AST_MATCH_HPP
19286 
19287 namespace nmodl {
19288 namespace ast {
19289 
19290 /**
19291  * @addtogroup ast_class
19292  * @ingroup ast
19293  * @{
19294  */
19295 
19296 /**
19297  * \brief TODO
19298  *
19299  *
19300  */
19301 class Match : public Expression {
19302 private:
19303  /// TODO
19304  std::shared_ptr<Identifier> name;
19305  /// TODO
19306  std::shared_ptr<Expression> expression;
19307  /// token with location information
19308  std::shared_ptr<ModToken> token;
19309 
19310 public:
19311  /// \name Ctor & dtor
19312  /// \{
19313 
19314  explicit Match(Identifier *name, Expression *expression);
19315  explicit Match(const std::shared_ptr<Identifier> &name,
19316  const std::shared_ptr<Expression> &expression);
19317  Match(const Match &obj);
19318 
19319  virtual ~Match() = default;
19320 
19321  /// \}
19322 
19323  /**
19324  * \brief Check if the ast node is an instance of ast::Match
19325  * \return true as object is of type ast::Match
19326  */
19327  bool is_match() const noexcept override { return true; }
19328 
19329  /**
19330  * \brief Return a copy of the current node
19331  *
19332  * Recursively make a new copy/clone of the current node including
19333  * all members and return a pointer to the node. This is used for
19334  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
19335  * ast.
19336  *
19337  * @return pointer to the clone/copy of the current node
19338  */
19339  Match *clone() const override { return new Match(*this); }
19340 
19341  /// \name Getters
19342  /// \{
19343 
19344  /**
19345  * \brief Return type (ast::AstNodeType) of ast node
19346  *
19347  * Every node in the ast has a type defined in ast::AstNodeType and this
19348  * function is used to retrieve the same.
19349  *
19350  * \return ast node type i.e. ast::AstNodeType::MATCH
19351  *
19352  * \sa Ast::get_node_type_name
19353  */
19354  AstNodeType get_node_type() const noexcept override {
19355  return AstNodeType::MATCH;
19356  }
19357 
19358  /**
19359  * \brief Return type (ast::AstNodeType) of ast node as std::string
19360  *
19361  * Every node in the ast has a type defined in ast::AstNodeType.
19362  * This type name can be returned as a std::string for printing
19363  * node to text/json form.
19364  *
19365  * \return name of the node type as a string i.e. "Match"
19366  *
19367  * \sa Ast::get_node_name
19368  */
19369  std::string get_node_type_name() const noexcept override { return "Match"; }
19370 
19371  /**
19372  * \brief Get std::shared_ptr from `this` pointer of the current ast node
19373  */
19374  std::shared_ptr<Ast> get_shared_ptr() override {
19375  return std::static_pointer_cast<Match>(shared_from_this());
19376  }
19377 
19378  /**
19379  * \brief Get std::shared_ptr from `this` pointer of the current ast node
19380  */
19381  std::shared_ptr<const Ast> get_shared_ptr() const override {
19382  return std::static_pointer_cast<const Match>(shared_from_this());
19383  }
19384 
19385  /**
19386  * \brief Return associated token for the current ast node
19387  *
19388  * Not all ast nodes have token information. For example,
19389  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
19390  * solution of ODEs. In this case, we return nullptr to store in the
19391  * nmodl::symtab::SymbolTable.
19392  *
19393  * \return pointer to token if exist otherwise nullptr
19394  */
19395  const ModToken *get_token() const noexcept override { return token.get(); }
19396 
19397  /**
19398  * \brief Getter for member variable \ref Match.name
19399  */
19400  const std::shared_ptr<Identifier> &get_name() const noexcept { return name; }
19401 
19402  /**
19403  * \brief Getter for member variable \ref Match.expression
19404  */
19405  const std::shared_ptr<Expression> &get_expression() const noexcept {
19406  return expression;
19407  }
19408 
19409  /// \}
19410 
19411  /// \name Setters
19412  /// \{
19413 
19414  /**
19415  * \brief Set token for the current ast node
19416  */
19417  void set_token(const ModToken &tok) {
19418  token = std::make_shared<ModToken>(tok);
19419  }
19420 
19421  /**
19422  * \brief Setter for member variable \ref Match.name (rvalue reference)
19423  */
19424  void set_name(std::shared_ptr<Identifier> &&name);
19425 
19426  /**
19427  * \brief Setter for member variable \ref Match.name
19428  */
19429  void set_name(const std::shared_ptr<Identifier> &name);
19430 
19431  /**
19432  * \brief Setter for member variable \ref Match.expression (rvalue reference)
19433  */
19434  void set_expression(std::shared_ptr<Expression> &&expression);
19435 
19436  /**
19437  * \brief Setter for member variable \ref Match.expression
19438  */
19439  void set_expression(const std::shared_ptr<Expression> &expression);
19440 
19441  /// \}
19442 
19443  /// \name Visitor
19444  /// \{
19445 
19446  /**
19447  * \brief visit children i.e. member variables of current node using provided
19448  * visitor
19449  *
19450  * Different nodes in the AST have different members (i.e. children). This
19451  * method recursively visits children using provided visitor.
19452  *
19453  * \param v Concrete visitor that will be used to recursively visit children
19454  *
19455  * \sa Ast::visit_children for example.
19456  */
19457  void visit_children(visitor::Visitor &v) override;
19458 
19459  /**
19460  * \brief visit children i.e. member variables of current node using provided
19461  * visitor
19462  *
19463  * Different nodes in the AST have different members (i.e. children). This
19464  * method recursively visits children using provided visitor.
19465  *
19466  * \param v Concrete constant visitor that will be used to recursively visit
19467  * children
19468  *
19469  * \sa Ast::visit_children for example.
19470  */
19471  void visit_children(visitor::ConstVisitor &v) const override;
19472 
19473  /**
19474  * \brief accept (or visit) the current AST node using provided visitor
19475  *
19476  * Instead of visiting children of AST node, like Ast::visit_children,
19477  * accept allows to visit the current node itself using provided concrete
19478  * visitor.
19479  *
19480  * \param v Concrete visitor that will be used to recursively visit node
19481  *
19482  * \sa Ast::accept for example.
19483  */
19484  void accept(visitor::Visitor &v) override;
19485 
19486  /**
19487  * \copydoc accept(visitor::Visitor&)
19488  */
19489  void accept(visitor::ConstVisitor &v) const override;
19490 
19491  /// \}
19492 
19493 private:
19494  /**
19495  * \brief Set this object as parent for all the children
19496  *
19497  * This should be called in every object (with children) constructor
19498  * to set parents. Since it is called only in the constructors it
19499  * should not be virtual to avoid ambiguities (issue #295).
19500  */
19501  void set_parent_in_children();
19502 };
19503 
19504 /** @} */ // end of ast_class
19505 
19506 } // namespace ast
19507 } // namespace nmodl
19508 #endif // !NMODL_AST_MATCH_HPP
19509 #ifndef NMODL_AST_BA_BLOCK_TYPE_HPP
19510 #define NMODL_AST_BA_BLOCK_TYPE_HPP
19511 
19512 namespace nmodl {
19513 namespace ast {
19514 
19515 /**
19516  * @addtogroup ast_class
19517  * @ingroup ast
19518  * @{
19519  */
19520 
19521 /**
19522  * \brief Type to represent different block types for before/after block
19523  *
19524  * Different NMODL blocks can be used with ast::BeforeBlock and ast::AfterBlock.
19525  * This type is used to represent such block types.
19526  *
19527  * \sa ast::BeforeBlock as::AfterBlock
19528  *
19529  */
19530 class BABlockType : public Expression {
19531 private:
19532  /// block type
19534  /// token with location information
19535  std::shared_ptr<ModToken> token;
19536 
19537 public:
19538  /// \name Ctor & dtor
19539  /// \{
19540 
19541  explicit BABlockType(BAType value);
19542  BABlockType(const BABlockType &obj);
19543 
19544  virtual ~BABlockType() = default;
19545 
19546  /// \}
19547 
19548  /**
19549  * \brief Check if the ast node is an instance of ast::BABlockType
19550  * \return true as object is of type ast::BABlockType
19551  */
19552  bool is_ba_block_type() const noexcept override { return true; }
19553 
19554  /**
19555  * \brief Return a copy of the current node
19556  *
19557  * Recursively make a new copy/clone of the current node including
19558  * all members and return a pointer to the node. This is used for
19559  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
19560  * ast.
19561  *
19562  * @return pointer to the clone/copy of the current node
19563  */
19564  BABlockType *clone() const override { return new BABlockType(*this); }
19565 
19566  /// \name Getters
19567  /// \{
19568 
19569  /**
19570  * \brief Return type (ast::AstNodeType) of ast node
19571  *
19572  * Every node in the ast has a type defined in ast::AstNodeType and this
19573  * function is used to retrieve the same.
19574  *
19575  * \return ast node type i.e. ast::AstNodeType::BA_BLOCK_TYPE
19576  *
19577  * \sa Ast::get_node_type_name
19578  */
19579  AstNodeType get_node_type() const noexcept override {
19581  }
19582 
19583  /**
19584  * \brief Return type (ast::AstNodeType) of ast node as std::string
19585  *
19586  * Every node in the ast has a type defined in ast::AstNodeType.
19587  * This type name can be returned as a std::string for printing
19588  * node to text/json form.
19589  *
19590  * \return name of the node type as a string i.e. "BABlockType"
19591  *
19592  * \sa Ast::get_node_name
19593  */
19594  std::string get_node_type_name() const noexcept override {
19595  return "BABlockType";
19596  }
19597 
19598  /**
19599  * \brief Get std::shared_ptr from `this` pointer of the current ast node
19600  */
19601  std::shared_ptr<Ast> get_shared_ptr() override {
19602  return std::static_pointer_cast<BABlockType>(shared_from_this());
19603  }
19604 
19605  /**
19606  * \brief Get std::shared_ptr from `this` pointer of the current ast node
19607  */
19608  std::shared_ptr<const Ast> get_shared_ptr() const override {
19609  return std::static_pointer_cast<const BABlockType>(shared_from_this());
19610  }
19611 
19612  /**
19613  * \brief Return associated token for the current ast node
19614  *
19615  * Not all ast nodes have token information. For example,
19616  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
19617  * solution of ODEs. In this case, we return nullptr to store in the
19618  * nmodl::symtab::SymbolTable.
19619  *
19620  * \return pointer to token if exist otherwise nullptr
19621  */
19622  const ModToken *get_token() const noexcept override { return token.get(); }
19623 
19624  /**
19625  * \brief Getter for member variable \ref BABlockType.value
19626  */
19627  BAType get_value() const noexcept { return value; }
19628 
19629  /// \}
19630 
19631  /// \name Setters
19632  /// \{
19633 
19634  /**
19635  * \brief Set token for the current ast node
19636  */
19637  void set_token(const ModToken &tok) {
19638  token = std::make_shared<ModToken>(tok);
19639  }
19640 
19641  /**
19642  * \brief Setter for member variable \ref BABlockType.value
19643  */
19644  void set_value(BAType value);
19645 
19646  /// \}
19647 
19648  /// \name Visitor
19649  /// \{
19650 
19651  /**
19652  * \brief visit children i.e. member variables of current node using provided
19653  * visitor
19654  *
19655  * Different nodes in the AST have different members (i.e. children). This
19656  * method recursively visits children using provided visitor.
19657  *
19658  * \param v Concrete visitor that will be used to recursively visit children
19659  *
19660  * \sa Ast::visit_children for example.
19661  */
19662  void visit_children(visitor::Visitor &v) override;
19663 
19664  /**
19665  * \brief visit children i.e. member variables of current node using provided
19666  * visitor
19667  *
19668  * Different nodes in the AST have different members (i.e. children). This
19669  * method recursively visits children using provided visitor.
19670  *
19671  * \param v Concrete constant visitor that will be used to recursively visit
19672  * children
19673  *
19674  * \sa Ast::visit_children for example.
19675  */
19676  void visit_children(visitor::ConstVisitor &v) const override;
19677 
19678  /**
19679  * \brief accept (or visit) the current AST node using provided visitor
19680  *
19681  * Instead of visiting children of AST node, like Ast::visit_children,
19682  * accept allows to visit the current node itself using provided concrete
19683  * visitor.
19684  *
19685  * \param v Concrete visitor that will be used to recursively visit node
19686  *
19687  * \sa Ast::accept for example.
19688  */
19689  void accept(visitor::Visitor &v) override;
19690 
19691  /**
19692  * \copydoc accept(visitor::Visitor&)
19693  */
19694  void accept(visitor::ConstVisitor &v) const override;
19695 
19696  /// \}
19697 
19698  /**
19699  * \brief Return enum value in string form
19700  *
19701  * Enum variables (e.g. ast::BinaryOp, ast::UnitStateType) have
19702  * string representation when they are converted from AST back to
19703  * NMODL. This method is used to return corresponding string representation.
19704  */
19705  std::string eval() const { return BATypeNames[value]; }
19706 
19707 private:
19708  /**
19709  * \brief Set this object as parent for all the children
19710  *
19711  * This should be called in every object (with children) constructor
19712  * to set parents. Since it is called only in the constructors it
19713  * should not be virtual to avoid ambiguities (issue #295).
19714  */
19715  void set_parent_in_children();
19716 };
19717 
19718 /** @} */ // end of ast_class
19719 
19720 } // namespace ast
19721 } // namespace nmodl
19722 #endif // !NMODL_AST_BA_BLOCK_TYPE_HPP
19723 #ifndef NMODL_AST_UNIT_DEF_HPP
19724 #define NMODL_AST_UNIT_DEF_HPP
19725 
19726 namespace nmodl {
19727 namespace ast {
19728 
19729 /**
19730  * @addtogroup ast_class
19731  * @ingroup ast
19732  * @{
19733  */
19734 
19735 /**
19736  * \brief TODO
19737  *
19738  *
19739  */
19740 class UnitDef : public Expression {
19741 private:
19742  /// TODO
19743  std::shared_ptr<Unit> unit1;
19744  /// TODO
19745  std::shared_ptr<Unit> unit2;
19746  /// token with location information
19747  std::shared_ptr<ModToken> token;
19748 
19749 public:
19750  /// \name Ctor & dtor
19751  /// \{
19752 
19753  explicit UnitDef(Unit *unit1, Unit *unit2);
19754  explicit UnitDef(const std::shared_ptr<Unit> &unit1,
19755  const std::shared_ptr<Unit> &unit2);
19756  UnitDef(const UnitDef &obj);
19757 
19758  virtual ~UnitDef() = default;
19759 
19760  /// \}
19761 
19762  /**
19763  * \brief Check if the ast node is an instance of ast::UnitDef
19764  * \return true as object is of type ast::UnitDef
19765  */
19766  bool is_unit_def() const noexcept override { return true; }
19767 
19768  /**
19769  * \brief Return a copy of the current node
19770  *
19771  * Recursively make a new copy/clone of the current node including
19772  * all members and return a pointer to the node. This is used for
19773  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
19774  * ast.
19775  *
19776  * @return pointer to the clone/copy of the current node
19777  */
19778  UnitDef *clone() const override { return new UnitDef(*this); }
19779 
19780  /// \name Getters
19781  /// \{
19782 
19783  /**
19784  * \brief Return type (ast::AstNodeType) of ast node
19785  *
19786  * Every node in the ast has a type defined in ast::AstNodeType and this
19787  * function is used to retrieve the same.
19788  *
19789  * \return ast node type i.e. ast::AstNodeType::UNIT_DEF
19790  *
19791  * \sa Ast::get_node_type_name
19792  */
19793  AstNodeType get_node_type() const noexcept override {
19794  return AstNodeType::UNIT_DEF;
19795  }
19796 
19797  /**
19798  * \brief Return type (ast::AstNodeType) of ast node as std::string
19799  *
19800  * Every node in the ast has a type defined in ast::AstNodeType.
19801  * This type name can be returned as a std::string for printing
19802  * node to text/json form.
19803  *
19804  * \return name of the node type as a string i.e. "UnitDef"
19805  *
19806  * \sa Ast::get_node_name
19807  */
19808  std::string get_node_type_name() const noexcept override { return "UnitDef"; }
19809 
19810  /**
19811  * \brief Get std::shared_ptr from `this` pointer of the current ast node
19812  */
19813  std::shared_ptr<Ast> get_shared_ptr() override {
19814  return std::static_pointer_cast<UnitDef>(shared_from_this());
19815  }
19816 
19817  /**
19818  * \brief Get std::shared_ptr from `this` pointer of the current ast node
19819  */
19820  std::shared_ptr<const Ast> get_shared_ptr() const override {
19821  return std::static_pointer_cast<const UnitDef>(shared_from_this());
19822  }
19823 
19824  /**
19825  * \brief Return associated token for the current ast node
19826  *
19827  * Not all ast nodes have token information. For example,
19828  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
19829  * solution of ODEs. In this case, we return nullptr to store in the
19830  * nmodl::symtab::SymbolTable.
19831  *
19832  * \return pointer to token if exist otherwise nullptr
19833  */
19834  const ModToken *get_token() const noexcept override { return token.get(); }
19835 
19836  /**
19837  * \brief Return name of the node
19838  *
19839  * Some ast nodes have a member marked designated as node name. For example,
19840  * in case of this ast::Unit has unit1 designated as a
19841  * node name.
19842  *
19843  * @return name of the node as std::string
19844  *
19845  * \sa Ast::get_node_type_name
19846  */
19847  std::string get_node_name() const override;
19848 
19849  /**
19850  * \brief Getter for member variable \ref UnitDef.unit1
19851  */
19852  const std::shared_ptr<Unit> &get_unit1() const noexcept { return unit1; }
19853 
19854  /**
19855  * \brief Getter for member variable \ref UnitDef.unit2
19856  */
19857  const std::shared_ptr<Unit> &get_unit2() const noexcept { return unit2; }
19858 
19859  /// \}
19860 
19861  /// \name Setters
19862  /// \{
19863 
19864  /**
19865  * \brief Set token for the current ast node
19866  */
19867  void set_token(const ModToken &tok) {
19868  token = std::make_shared<ModToken>(tok);
19869  }
19870 
19871  /**
19872  * \brief Setter for member variable \ref UnitDef.unit1 (rvalue reference)
19873  */
19874  void set_unit1(std::shared_ptr<Unit> &&unit1);
19875 
19876  /**
19877  * \brief Setter for member variable \ref UnitDef.unit1
19878  */
19879  void set_unit1(const std::shared_ptr<Unit> &unit1);
19880 
19881  /**
19882  * \brief Setter for member variable \ref UnitDef.unit2 (rvalue reference)
19883  */
19884  void set_unit2(std::shared_ptr<Unit> &&unit2);
19885 
19886  /**
19887  * \brief Setter for member variable \ref UnitDef.unit2
19888  */
19889  void set_unit2(const std::shared_ptr<Unit> &unit2);
19890 
19891  /// \}
19892 
19893  /// \name Visitor
19894  /// \{
19895 
19896  /**
19897  * \brief visit children i.e. member variables of current node using provided
19898  * visitor
19899  *
19900  * Different nodes in the AST have different members (i.e. children). This
19901  * method recursively visits children using provided visitor.
19902  *
19903  * \param v Concrete visitor that will be used to recursively visit children
19904  *
19905  * \sa Ast::visit_children for example.
19906  */
19907  void visit_children(visitor::Visitor &v) override;
19908 
19909  /**
19910  * \brief visit children i.e. member variables of current node using provided
19911  * visitor
19912  *
19913  * Different nodes in the AST have different members (i.e. children). This
19914  * method recursively visits children using provided visitor.
19915  *
19916  * \param v Concrete constant visitor that will be used to recursively visit
19917  * children
19918  *
19919  * \sa Ast::visit_children for example.
19920  */
19921  void visit_children(visitor::ConstVisitor &v) const override;
19922 
19923  /**
19924  * \brief accept (or visit) the current AST node using provided visitor
19925  *
19926  * Instead of visiting children of AST node, like Ast::visit_children,
19927  * accept allows to visit the current node itself using provided concrete
19928  * visitor.
19929  *
19930  * \param v Concrete visitor that will be used to recursively visit node
19931  *
19932  * \sa Ast::accept for example.
19933  */
19934  void accept(visitor::Visitor &v) override;
19935 
19936  /**
19937  * \copydoc accept(visitor::Visitor&)
19938  */
19939  void accept(visitor::ConstVisitor &v) const override;
19940 
19941  /// \}
19942 
19943 private:
19944  /**
19945  * \brief Set this object as parent for all the children
19946  *
19947  * This should be called in every object (with children) constructor
19948  * to set parents. Since it is called only in the constructors it
19949  * should not be virtual to avoid ambiguities (issue #295).
19950  */
19951  void set_parent_in_children();
19952 };
19953 
19954 /** @} */ // end of ast_class
19955 
19956 } // namespace ast
19957 } // namespace nmodl
19958 #endif // !NMODL_AST_UNIT_DEF_HPP
19959 #ifndef NMODL_AST_FACTOR_DEF_HPP
19960 #define NMODL_AST_FACTOR_DEF_HPP
19961 
19962 namespace nmodl {
19963 namespace ast {
19964 
19965 /**
19966  * @addtogroup ast_class
19967  * @ingroup ast
19968  * @{
19969  */
19970 
19971 /**
19972  * \brief TODO
19973  *
19974  *
19975  */
19976 class FactorDef : public Expression {
19977 private:
19978  /// TODO
19979  std::shared_ptr<Name> name;
19980  /// TODO
19981  std::shared_ptr<Double> value;
19982  /// TODO
19983  std::shared_ptr<Unit> unit1;
19984  /// Todo: Michael : rename variable gt as well
19985  std::shared_ptr<Boolean> gt;
19986  /// TODO
19987  std::shared_ptr<Unit> unit2;
19988  /// token with location information
19989  std::shared_ptr<ModToken> token;
19990 
19991 public:
19992  /// \name Ctor & dtor
19993  /// \{
19994 
19995  explicit FactorDef(Name *name, Double *value, Unit *unit1, Boolean *gt,
19996  Unit *unit2);
19997  explicit FactorDef(const std::shared_ptr<Name> &name,
19998  const std::shared_ptr<Double> &value,
19999  const std::shared_ptr<Unit> &unit1,
20000  const std::shared_ptr<Boolean> &gt,
20001  const std::shared_ptr<Unit> &unit2);
20002  FactorDef(const FactorDef &obj);
20003 
20004  FactorDef() = default;
20005 
20006  virtual ~FactorDef() = default;
20007 
20008  /// \}
20009 
20010  /**
20011  * \brief Check if the ast node is an instance of ast::FactorDef
20012  * \return true as object is of type ast::FactorDef
20013  */
20014  bool is_factor_def() const noexcept override { return true; }
20015 
20016  /**
20017  * \brief Return a copy of the current node
20018  *
20019  * Recursively make a new copy/clone of the current node including
20020  * all members and return a pointer to the node. This is used for
20021  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
20022  * ast.
20023  *
20024  * @return pointer to the clone/copy of the current node
20025  */
20026  FactorDef *clone() const override { return new FactorDef(*this); }
20027 
20028  /// \name Getters
20029  /// \{
20030 
20031  /**
20032  * \brief Return type (ast::AstNodeType) of ast node
20033  *
20034  * Every node in the ast has a type defined in ast::AstNodeType and this
20035  * function is used to retrieve the same.
20036  *
20037  * \return ast node type i.e. ast::AstNodeType::FACTOR_DEF
20038  *
20039  * \sa Ast::get_node_type_name
20040  */
20041  AstNodeType get_node_type() const noexcept override {
20042  return AstNodeType::FACTOR_DEF;
20043  }
20044 
20045  /**
20046  * \brief Return type (ast::AstNodeType) of ast node as std::string
20047  *
20048  * Every node in the ast has a type defined in ast::AstNodeType.
20049  * This type name can be returned as a std::string for printing
20050  * node to text/json form.
20051  *
20052  * \return name of the node type as a string i.e. "FactorDef"
20053  *
20054  * \sa Ast::get_node_name
20055  */
20056  std::string get_node_type_name() const noexcept override {
20057  return "FactorDef";
20058  }
20059 
20060  /**
20061  * \brief Get std::shared_ptr from `this` pointer of the current ast node
20062  */
20063  std::shared_ptr<Ast> get_shared_ptr() override {
20064  return std::static_pointer_cast<FactorDef>(shared_from_this());
20065  }
20066 
20067  /**
20068  * \brief Get std::shared_ptr from `this` pointer of the current ast node
20069  */
20070  std::shared_ptr<const Ast> get_shared_ptr() const override {
20071  return std::static_pointer_cast<const FactorDef>(shared_from_this());
20072  }
20073 
20074  /**
20075  * \brief Return associated token for the current ast node
20076  *
20077  * Not all ast nodes have token information. For example,
20078  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
20079  * solution of ODEs. In this case, we return nullptr to store in the
20080  * nmodl::symtab::SymbolTable.
20081  *
20082  * \return pointer to token if exist otherwise nullptr
20083  */
20084  const ModToken *get_token() const noexcept override { return token.get(); }
20085 
20086  /**
20087  * \brief Return name of the node
20088  *
20089  * Some ast nodes have a member marked designated as node name. For example,
20090  * in case of this ast::Name has name designated as a
20091  * node name.
20092  *
20093  * @return name of the node as std::string
20094  *
20095  * \sa Ast::get_node_type_name
20096  */
20097  std::string get_node_name() const override;
20098 
20099  /**
20100  * \brief Getter for member variable \ref FactorDef.name
20101  */
20102  const std::shared_ptr<Name> &get_name() const noexcept { return name; }
20103 
20104  /**
20105  * \brief Getter for member variable \ref FactorDef.value
20106  */
20107  const std::shared_ptr<Double> &get_value() const noexcept { return value; }
20108 
20109  /**
20110  * \brief Getter for member variable \ref FactorDef.unit1
20111  */
20112  const std::shared_ptr<Unit> &get_unit1() const noexcept { return unit1; }
20113 
20114  /**
20115  * \brief Getter for member variable \ref FactorDef.gt
20116  */
20117  const std::shared_ptr<Boolean> &get_gt() const noexcept { return gt; }
20118 
20119  /**
20120  * \brief Getter for member variable \ref FactorDef.unit2
20121  */
20122  const std::shared_ptr<Unit> &get_unit2() const noexcept { return unit2; }
20123 
20124  /// \}
20125 
20126  /// \name Setters
20127  /// \{
20128 
20129  /**
20130  * \brief Set token for the current ast node
20131  */
20132  void set_token(const ModToken &tok) {
20133  token = std::make_shared<ModToken>(tok);
20134  }
20135 
20136  /**
20137  * \brief Setter for member variable \ref FactorDef.name (rvalue reference)
20138  */
20139  void set_name(std::shared_ptr<Name> &&name);
20140 
20141  /**
20142  * \brief Setter for member variable \ref FactorDef.name
20143  */
20144  void set_name(const std::shared_ptr<Name> &name);
20145 
20146  /**
20147  * \brief Setter for member variable \ref FactorDef.value (rvalue reference)
20148  */
20149  void set_value(std::shared_ptr<Double> &&value);
20150 
20151  /**
20152  * \brief Setter for member variable \ref FactorDef.value
20153  */
20154  void set_value(const std::shared_ptr<Double> &value);
20155 
20156  /**
20157  * \brief Setter for member variable \ref FactorDef.unit1 (rvalue reference)
20158  */
20159  void set_unit1(std::shared_ptr<Unit> &&unit1);
20160 
20161  /**
20162  * \brief Setter for member variable \ref FactorDef.unit1
20163  */
20164  void set_unit1(const std::shared_ptr<Unit> &unit1);
20165 
20166  /**
20167  * \brief Setter for member variable \ref FactorDef.gt (rvalue reference)
20168  */
20169  void set_gt(std::shared_ptr<Boolean> &&gt);
20170 
20171  /**
20172  * \brief Setter for member variable \ref FactorDef.gt
20173  */
20174  void set_gt(const std::shared_ptr<Boolean> &gt);
20175 
20176  /**
20177  * \brief Setter for member variable \ref FactorDef.unit2 (rvalue reference)
20178  */
20179  void set_unit2(std::shared_ptr<Unit> &&unit2);
20180 
20181  /**
20182  * \brief Setter for member variable \ref FactorDef.unit2
20183  */
20184  void set_unit2(const std::shared_ptr<Unit> &unit2);
20185 
20186  /// \}
20187 
20188  /// \name Visitor
20189  /// \{
20190 
20191  /**
20192  * \brief visit children i.e. member variables of current node using provided
20193  * visitor
20194  *
20195  * Different nodes in the AST have different members (i.e. children). This
20196  * method recursively visits children using provided visitor.
20197  *
20198  * \param v Concrete visitor that will be used to recursively visit children
20199  *
20200  * \sa Ast::visit_children for example.
20201  */
20202  void visit_children(visitor::Visitor &v) override;
20203 
20204  /**
20205  * \brief visit children i.e. member variables of current node using provided
20206  * visitor
20207  *
20208  * Different nodes in the AST have different members (i.e. children). This
20209  * method recursively visits children using provided visitor.
20210  *
20211  * \param v Concrete constant visitor that will be used to recursively visit
20212  * children
20213  *
20214  * \sa Ast::visit_children for example.
20215  */
20216  void visit_children(visitor::ConstVisitor &v) const override;
20217 
20218  /**
20219  * \brief accept (or visit) the current AST node using provided visitor
20220  *
20221  * Instead of visiting children of AST node, like Ast::visit_children,
20222  * accept allows to visit the current node itself using provided concrete
20223  * visitor.
20224  *
20225  * \param v Concrete visitor that will be used to recursively visit node
20226  *
20227  * \sa Ast::accept for example.
20228  */
20229  void accept(visitor::Visitor &v) override;
20230 
20231  /**
20232  * \copydoc accept(visitor::Visitor&)
20233  */
20234  void accept(visitor::ConstVisitor &v) const override;
20235 
20236  /// \}
20237 
20238 private:
20239  /**
20240  * \brief Set this object as parent for all the children
20241  *
20242  * This should be called in every object (with children) constructor
20243  * to set parents. Since it is called only in the constructors it
20244  * should not be virtual to avoid ambiguities (issue #295).
20245  */
20246  void set_parent_in_children();
20247 };
20248 
20249 /** @} */ // end of ast_class
20250 
20251 } // namespace ast
20252 } // namespace nmodl
20253 #endif // !NMODL_AST_FACTOR_DEF_HPP
20254 #ifndef NMODL_AST_VALENCE_HPP
20255 #define NMODL_AST_VALENCE_HPP
20256 
20257 namespace nmodl {
20258 namespace ast {
20259 
20260 /**
20261  * @addtogroup ast_class
20262  * @ingroup ast
20263  * @{
20264  */
20265 
20266 /**
20267  * \brief TODO
20268  *
20269  *
20270  */
20271 class Valence : public Expression {
20272 private:
20273  /// TODO
20274  std::shared_ptr<Name> type;
20275  /// TODO
20276  std::shared_ptr<Double> value;
20277  /// token with location information
20278  std::shared_ptr<ModToken> token;
20279 
20280 public:
20281  /// \name Ctor & dtor
20282  /// \{
20283 
20284  explicit Valence(Name *type, Double *value);
20285  explicit Valence(const std::shared_ptr<Name> &type,
20286  const std::shared_ptr<Double> &value);
20287  Valence(const Valence &obj);
20288 
20289  virtual ~Valence() = default;
20290 
20291  /// \}
20292 
20293  /**
20294  * \brief Check if the ast node is an instance of ast::Valence
20295  * \return true as object is of type ast::Valence
20296  */
20297  bool is_valence() const noexcept override { return true; }
20298 
20299  /**
20300  * \brief Return a copy of the current node
20301  *
20302  * Recursively make a new copy/clone of the current node including
20303  * all members and return a pointer to the node. This is used for
20304  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
20305  * ast.
20306  *
20307  * @return pointer to the clone/copy of the current node
20308  */
20309  Valence *clone() const override { return new Valence(*this); }
20310 
20311  /// \name Getters
20312  /// \{
20313 
20314  /**
20315  * \brief Return type (ast::AstNodeType) of ast node
20316  *
20317  * Every node in the ast has a type defined in ast::AstNodeType and this
20318  * function is used to retrieve the same.
20319  *
20320  * \return ast node type i.e. ast::AstNodeType::VALENCE
20321  *
20322  * \sa Ast::get_node_type_name
20323  */
20324  AstNodeType get_node_type() const noexcept override {
20325  return AstNodeType::VALENCE;
20326  }
20327 
20328  /**
20329  * \brief Return type (ast::AstNodeType) of ast node as std::string
20330  *
20331  * Every node in the ast has a type defined in ast::AstNodeType.
20332  * This type name can be returned as a std::string for printing
20333  * node to text/json form.
20334  *
20335  * \return name of the node type as a string i.e. "Valence"
20336  *
20337  * \sa Ast::get_node_name
20338  */
20339  std::string get_node_type_name() const noexcept override { return "Valence"; }
20340 
20341  /**
20342  * \brief Get std::shared_ptr from `this` pointer of the current ast node
20343  */
20344  std::shared_ptr<Ast> get_shared_ptr() override {
20345  return std::static_pointer_cast<Valence>(shared_from_this());
20346  }
20347 
20348  /**
20349  * \brief Get std::shared_ptr from `this` pointer of the current ast node
20350  */
20351  std::shared_ptr<const Ast> get_shared_ptr() const override {
20352  return std::static_pointer_cast<const Valence>(shared_from_this());
20353  }
20354 
20355  /**
20356  * \brief Return associated token for the current ast node
20357  *
20358  * Not all ast nodes have token information. For example,
20359  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
20360  * solution of ODEs. In this case, we return nullptr to store in the
20361  * nmodl::symtab::SymbolTable.
20362  *
20363  * \return pointer to token if exist otherwise nullptr
20364  */
20365  const ModToken *get_token() const noexcept override { return token.get(); }
20366 
20367  /**
20368  * \brief Getter for member variable \ref Valence.type
20369  */
20370  const std::shared_ptr<Name> &get_type() const noexcept { return type; }
20371 
20372  /**
20373  * \brief Getter for member variable \ref Valence.value
20374  */
20375  const std::shared_ptr<Double> &get_value() const noexcept { return value; }
20376 
20377  /// \}
20378 
20379  /// \name Setters
20380  /// \{
20381 
20382  /**
20383  * \brief Set token for the current ast node
20384  */
20385  void set_token(const ModToken &tok) {
20386  token = std::make_shared<ModToken>(tok);
20387  }
20388 
20389  /**
20390  * \brief Setter for member variable \ref Valence.type (rvalue reference)
20391  */
20392  void set_type(std::shared_ptr<Name> &&type);
20393 
20394  /**
20395  * \brief Setter for member variable \ref Valence.type
20396  */
20397  void set_type(const std::shared_ptr<Name> &type);
20398 
20399  /**
20400  * \brief Setter for member variable \ref Valence.value (rvalue reference)
20401  */
20402  void set_value(std::shared_ptr<Double> &&value);
20403 
20404  /**
20405  * \brief Setter for member variable \ref Valence.value
20406  */
20407  void set_value(const std::shared_ptr<Double> &value);
20408 
20409  /// \}
20410 
20411  /// \name Visitor
20412  /// \{
20413 
20414  /**
20415  * \brief visit children i.e. member variables of current node using provided
20416  * visitor
20417  *
20418  * Different nodes in the AST have different members (i.e. children). This
20419  * method recursively visits children using provided visitor.
20420  *
20421  * \param v Concrete visitor that will be used to recursively visit children
20422  *
20423  * \sa Ast::visit_children for example.
20424  */
20425  void visit_children(visitor::Visitor &v) override;
20426 
20427  /**
20428  * \brief visit children i.e. member variables of current node using provided
20429  * visitor
20430  *
20431  * Different nodes in the AST have different members (i.e. children). This
20432  * method recursively visits children using provided visitor.
20433  *
20434  * \param v Concrete constant visitor that will be used to recursively visit
20435  * children
20436  *
20437  * \sa Ast::visit_children for example.
20438  */
20439  void visit_children(visitor::ConstVisitor &v) const override;
20440 
20441  /**
20442  * \brief accept (or visit) the current AST node using provided visitor
20443  *
20444  * Instead of visiting children of AST node, like Ast::visit_children,
20445  * accept allows to visit the current node itself using provided concrete
20446  * visitor.
20447  *
20448  * \param v Concrete visitor that will be used to recursively visit node
20449  *
20450  * \sa Ast::accept for example.
20451  */
20452  void accept(visitor::Visitor &v) override;
20453 
20454  /**
20455  * \copydoc accept(visitor::Visitor&)
20456  */
20457  void accept(visitor::ConstVisitor &v) const override;
20458 
20459  /// \}
20460 
20461 private:
20462  /**
20463  * \brief Set this object as parent for all the children
20464  *
20465  * This should be called in every object (with children) constructor
20466  * to set parents. Since it is called only in the constructors it
20467  * should not be virtual to avoid ambiguities (issue #295).
20468  */
20469  void set_parent_in_children();
20470 };
20471 
20472 /** @} */ // end of ast_class
20473 
20474 } // namespace ast
20475 } // namespace nmodl
20476 #endif // !NMODL_AST_VALENCE_HPP
20477 #ifndef NMODL_AST_UNIT_STATE_HPP
20478 #define NMODL_AST_UNIT_STATE_HPP
20479 
20480 namespace nmodl {
20481 namespace ast {
20482 
20483 /**
20484  * @addtogroup ast_class
20485  * @ingroup ast
20486  * @{
20487  */
20488 
20489 /**
20490  * \brief TODO
20491  *
20492  *
20493  */
20494 class UnitState : public Statement {
20495 private:
20496  /// TODO
20498  /// token with location information
20499  std::shared_ptr<ModToken> token;
20500 
20501 public:
20502  /// \name Ctor & dtor
20503  /// \{
20504 
20505  explicit UnitState(UnitStateType value);
20506  UnitState(const UnitState &obj);
20507 
20508  virtual ~UnitState() = default;
20509 
20510  /// \}
20511 
20512  /**
20513  * \brief Check if the ast node is an instance of ast::UnitState
20514  * \return true as object is of type ast::UnitState
20515  */
20516  bool is_unit_state() const noexcept override { return true; }
20517 
20518  /**
20519  * \brief Return a copy of the current node
20520  *
20521  * Recursively make a new copy/clone of the current node including
20522  * all members and return a pointer to the node. This is used for
20523  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
20524  * ast.
20525  *
20526  * @return pointer to the clone/copy of the current node
20527  */
20528  UnitState *clone() const override { return new UnitState(*this); }
20529 
20530  /// \name Getters
20531  /// \{
20532 
20533  /**
20534  * \brief Return type (ast::AstNodeType) of ast node
20535  *
20536  * Every node in the ast has a type defined in ast::AstNodeType and this
20537  * function is used to retrieve the same.
20538  *
20539  * \return ast node type i.e. ast::AstNodeType::UNIT_STATE
20540  *
20541  * \sa Ast::get_node_type_name
20542  */
20543  AstNodeType get_node_type() const noexcept override {
20544  return AstNodeType::UNIT_STATE;
20545  }
20546 
20547  /**
20548  * \brief Return type (ast::AstNodeType) of ast node as std::string
20549  *
20550  * Every node in the ast has a type defined in ast::AstNodeType.
20551  * This type name can be returned as a std::string for printing
20552  * node to text/json form.
20553  *
20554  * \return name of the node type as a string i.e. "UnitState"
20555  *
20556  * \sa Ast::get_node_name
20557  */
20558  std::string get_node_type_name() const noexcept override {
20559  return "UnitState";
20560  }
20561 
20562  /**
20563  * \brief Get std::shared_ptr from `this` pointer of the current ast node
20564  */
20565  std::shared_ptr<Ast> get_shared_ptr() override {
20566  return std::static_pointer_cast<UnitState>(shared_from_this());
20567  }
20568 
20569  /**
20570  * \brief Get std::shared_ptr from `this` pointer of the current ast node
20571  */
20572  std::shared_ptr<const Ast> get_shared_ptr() const override {
20573  return std::static_pointer_cast<const UnitState>(shared_from_this());
20574  }
20575 
20576  /**
20577  * \brief Return associated token for the current ast node
20578  *
20579  * Not all ast nodes have token information. For example,
20580  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
20581  * solution of ODEs. In this case, we return nullptr to store in the
20582  * nmodl::symtab::SymbolTable.
20583  *
20584  * \return pointer to token if exist otherwise nullptr
20585  */
20586  const ModToken *get_token() const noexcept override { return token.get(); }
20587 
20588  /**
20589  * \brief Getter for member variable \ref UnitState.value
20590  */
20591  UnitStateType get_value() const noexcept { return value; }
20592 
20593  /// \}
20594 
20595  /// \name Setters
20596  /// \{
20597 
20598  /**
20599  * \brief Set token for the current ast node
20600  */
20601  void set_token(const ModToken &tok) {
20602  token = std::make_shared<ModToken>(tok);
20603  }
20604 
20605  /**
20606  * \brief Setter for member variable \ref UnitState.value
20607  */
20608  void set_value(UnitStateType value);
20609 
20610  /// \}
20611 
20612  /// \name Visitor
20613  /// \{
20614 
20615  /**
20616  * \brief visit children i.e. member variables of current node using provided
20617  * visitor
20618  *
20619  * Different nodes in the AST have different members (i.e. children). This
20620  * method recursively visits children using provided visitor.
20621  *
20622  * \param v Concrete visitor that will be used to recursively visit children
20623  *
20624  * \sa Ast::visit_children for example.
20625  */
20626  void visit_children(visitor::Visitor &v) override;
20627 
20628  /**
20629  * \brief visit children i.e. member variables of current node using provided
20630  * visitor
20631  *
20632  * Different nodes in the AST have different members (i.e. children). This
20633  * method recursively visits children using provided visitor.
20634  *
20635  * \param v Concrete constant visitor that will be used to recursively visit
20636  * children
20637  *
20638  * \sa Ast::visit_children for example.
20639  */
20640  void visit_children(visitor::ConstVisitor &v) const override;
20641 
20642  /**
20643  * \brief accept (or visit) the current AST node using provided visitor
20644  *
20645  * Instead of visiting children of AST node, like Ast::visit_children,
20646  * accept allows to visit the current node itself using provided concrete
20647  * visitor.
20648  *
20649  * \param v Concrete visitor that will be used to recursively visit node
20650  *
20651  * \sa Ast::accept for example.
20652  */
20653  void accept(visitor::Visitor &v) override;
20654 
20655  /**
20656  * \copydoc accept(visitor::Visitor&)
20657  */
20658  void accept(visitor::ConstVisitor &v) const override;
20659 
20660  /// \}
20661 
20662  /**
20663  * \brief Return enum value in string form
20664  *
20665  * Enum variables (e.g. ast::BinaryOp, ast::UnitStateType) have
20666  * string representation when they are converted from AST back to
20667  * NMODL. This method is used to return corresponding string representation.
20668  */
20669  std::string eval() const { return UnitStateTypeNames[value]; }
20670 
20671 private:
20672  /**
20673  * \brief Set this object as parent for all the children
20674  *
20675  * This should be called in every object (with children) constructor
20676  * to set parents. Since it is called only in the constructors it
20677  * should not be virtual to avoid ambiguities (issue #295).
20678  */
20679  void set_parent_in_children();
20680 };
20681 
20682 /** @} */ // end of ast_class
20683 
20684 } // namespace ast
20685 } // namespace nmodl
20686 #endif // !NMODL_AST_UNIT_STATE_HPP
20687 #ifndef NMODL_AST_LOCAL_LIST_STATEMENT_HPP
20688 #define NMODL_AST_LOCAL_LIST_STATEMENT_HPP
20689 #define NMODL_AST_LOCAL_LIST_STATEMENT_HPP_INLINE_DEFINITION_REQUIRED
20690 
20691 namespace nmodl {
20692 namespace ast {
20693 
20694 /**
20695  * @addtogroup ast_class
20696  * @ingroup ast
20697  * @{
20698  */
20699 
20700 /**
20701  * \brief TODO
20702  *
20703  *
20704  */
20706 private:
20707  /// TODO
20709  /// token with location information
20710  std::shared_ptr<ModToken> token;
20711 
20712 public:
20713  /// \name Ctor & dtor
20714  /// \{
20715 
20716  explicit LocalListStatement(LocalVarVector variables);
20718 
20719  virtual ~LocalListStatement() = default;
20720 
20721  /// \}
20722 
20723  /**
20724  * \brief Check if the ast node is an instance of ast::LocalListStatement
20725  * \return true as object is of type ast::LocalListStatement
20726  */
20727  bool is_local_list_statement() const noexcept override { return true; }
20728 
20729  /**
20730  * \brief Return a copy of the current node
20731  *
20732  * Recursively make a new copy/clone of the current node including
20733  * all members and return a pointer to the node. This is used for
20734  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
20735  * ast.
20736  *
20737  * @return pointer to the clone/copy of the current node
20738  */
20739  LocalListStatement *clone() const override {
20740  return new LocalListStatement(*this);
20741  }
20742 
20743  /// \name Getters
20744  /// \{
20745 
20746  /**
20747  * \brief Return type (ast::AstNodeType) of ast node
20748  *
20749  * Every node in the ast has a type defined in ast::AstNodeType and this
20750  * function is used to retrieve the same.
20751  *
20752  * \return ast node type i.e. ast::AstNodeType::LOCAL_LIST_STATEMENT
20753  *
20754  * \sa Ast::get_node_type_name
20755  */
20756  AstNodeType get_node_type() const noexcept override {
20758  }
20759 
20760  /**
20761  * \brief Return type (ast::AstNodeType) of ast node as std::string
20762  *
20763  * Every node in the ast has a type defined in ast::AstNodeType.
20764  * This type name can be returned as a std::string for printing
20765  * node to text/json form.
20766  *
20767  * \return name of the node type as a string i.e. "LocalListStatement"
20768  *
20769  * \sa Ast::get_node_name
20770  */
20771  std::string get_node_type_name() const noexcept override {
20772  return "LocalListStatement";
20773  }
20774 
20775  /**
20776  * \brief Return NMODL statement of ast node as std::string
20777  *
20778  * Every node is related to a special statement in the NMODL. This
20779  * statement can be returned as a std::string for printing to
20780  * text/json form.
20781  *
20782  * \return name of the statement as a string i.e. "LOCAL "
20783  *
20784  * \sa Ast::get_nmodl_name
20785  */
20786  std::string get_nmodl_name() const noexcept override { return "LOCAL "; }
20787 
20788  /**
20789  * \brief Get std::shared_ptr from `this` pointer of the current ast node
20790  */
20791  std::shared_ptr<Ast> get_shared_ptr() override {
20792  return std::static_pointer_cast<LocalListStatement>(shared_from_this());
20793  }
20794 
20795  /**
20796  * \brief Get std::shared_ptr from `this` pointer of the current ast node
20797  */
20798  std::shared_ptr<const Ast> get_shared_ptr() const override {
20799  return std::static_pointer_cast<const LocalListStatement>(
20800  shared_from_this());
20801  }
20802 
20803  /**
20804  * \brief Return associated token for the current ast node
20805  *
20806  * Not all ast nodes have token information. For example,
20807  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
20808  * solution of ODEs. In this case, we return nullptr to store in the
20809  * nmodl::symtab::SymbolTable.
20810  *
20811  * \return pointer to token if exist otherwise nullptr
20812  */
20813  const ModToken *get_token() const noexcept override { return token.get(); }
20814 
20815  /**
20816  * \brief Add member to variables by raw pointer
20817  */
20818  void emplace_back_local_var(LocalVar *n);
20819 
20820  /**
20821  * \brief Add member to variables by shared_ptr
20822  */
20823  void emplace_back_local_var(std::shared_ptr<LocalVar> n);
20824 
20825  /**
20826  * \brief Erase member to variables
20827  */
20828  LocalVarVector::const_iterator
20829  erase_local_var(LocalVarVector::const_iterator first);
20830 
20831  /**
20832  * \brief Erase members to variables
20833  */
20834  LocalVarVector::const_iterator
20835  erase_local_var(LocalVarVector::const_iterator first,
20836  LocalVarVector::const_iterator last);
20837 
20838  /**
20839  * \brief Erase non-consecutive members to variables
20840  *
20841  * loosely following the cpp reference of remove_if
20842  */
20843  size_t erase_local_var(std::unordered_set<LocalVar *> &to_be_erased);
20844 
20845  /**
20846  * \brief Insert member to variables
20847  */
20848  LocalVarVector::const_iterator
20849  insert_local_var(LocalVarVector::const_iterator position,
20850  const std::shared_ptr<LocalVar> &n);
20851 
20852  /**
20853  * \brief Insert members to variables
20854  */
20855  template <class NodeType, class InputIterator>
20856  void insert_local_var(LocalVarVector::const_iterator position, NodeType &to,
20857  InputIterator first, InputIterator last);
20858 
20859  /**
20860  * \brief Reset member to variables
20861  */
20862  void reset_local_var(LocalVarVector::const_iterator position, LocalVar *n);
20863 
20864  /**
20865  * \brief Reset member to variables
20866  */
20867  void reset_local_var(LocalVarVector::const_iterator position,
20868  std::shared_ptr<LocalVar> n);
20869 
20870  /**
20871  * \brief Getter for member variable \ref LocalListStatement.variables
20872  */
20873  const LocalVarVector &get_variables() const noexcept { return variables; }
20874 
20875  /// \}
20876 
20877  /// \name Setters
20878  /// \{
20879 
20880  /**
20881  * \brief Set token for the current ast node
20882  */
20883  void set_token(const ModToken &tok) {
20884  token = std::make_shared<ModToken>(tok);
20885  }
20886 
20887  /**
20888  * \brief Setter for member variable \ref LocalListStatement.variables (rvalue
20889  * reference)
20890  */
20891  void set_variables(LocalVarVector &&variables);
20892 
20893  /**
20894  * \brief Setter for member variable \ref LocalListStatement.variables
20895  */
20896  void set_variables(const LocalVarVector &variables);
20897 
20898  /// \}
20899 
20900  /// \name Visitor
20901  /// \{
20902 
20903  /**
20904  * \brief visit children i.e. member variables of current node using provided
20905  * visitor
20906  *
20907  * Different nodes in the AST have different members (i.e. children). This
20908  * method recursively visits children using provided visitor.
20909  *
20910  * \param v Concrete visitor that will be used to recursively visit children
20911  *
20912  * \sa Ast::visit_children for example.
20913  */
20914  void visit_children(visitor::Visitor &v) override;
20915 
20916  /**
20917  * \brief visit children i.e. member variables of current node using provided
20918  * visitor
20919  *
20920  * Different nodes in the AST have different members (i.e. children). This
20921  * method recursively visits children using provided visitor.
20922  *
20923  * \param v Concrete constant visitor that will be used to recursively visit
20924  * children
20925  *
20926  * \sa Ast::visit_children for example.
20927  */
20928  void visit_children(visitor::ConstVisitor &v) const override;
20929 
20930  /**
20931  * \brief accept (or visit) the current AST node using provided visitor
20932  *
20933  * Instead of visiting children of AST node, like Ast::visit_children,
20934  * accept allows to visit the current node itself using provided concrete
20935  * visitor.
20936  *
20937  * \param v Concrete visitor that will be used to recursively visit node
20938  *
20939  * \sa Ast::accept for example.
20940  */
20941  void accept(visitor::Visitor &v) override;
20942 
20943  /**
20944  * \copydoc accept(visitor::Visitor&)
20945  */
20946  void accept(visitor::ConstVisitor &v) const override;
20947 
20948  /// \}
20949 
20950 private:
20951  /**
20952  * \brief Set this object as parent for all the children
20953  *
20954  * This should be called in every object (with children) constructor
20955  * to set parents. Since it is called only in the constructors it
20956  * should not be virtual to avoid ambiguities (issue #295).
20957  */
20958  void set_parent_in_children();
20959 };
20960 
20961 /** @} */ // end of ast_class
20962 
20963 } // namespace ast
20964 } // namespace nmodl
20965 #endif // !NMODL_AST_LOCAL_LIST_STATEMENT_HPP
20966 #ifndef NMODL_AST_MODEL_HPP
20967 #define NMODL_AST_MODEL_HPP
20968 
20969 namespace nmodl {
20970 namespace ast {
20971 
20972 /**
20973  * @addtogroup ast_class
20974  * @ingroup ast
20975  * @{
20976  */
20977 
20978 /**
20979  * \brief TODO
20980  *
20981  *
20982  */
20983 class Model : public Statement {
20984 private:
20985  /// TODO
20986  std::shared_ptr<String> title;
20987  /// token with location information
20988  std::shared_ptr<ModToken> token;
20989 
20990 public:
20991  /// \name Ctor & dtor
20992  /// \{
20993 
20994  explicit Model(String *title);
20995  explicit Model(const std::shared_ptr<String> &title);
20996  Model(const Model &obj);
20997 
20998  virtual ~Model() = default;
20999 
21000  /// \}
21001 
21002  /**
21003  * \brief Check if the ast node is an instance of ast::Model
21004  * \return true as object is of type ast::Model
21005  */
21006  bool is_model() const noexcept override { return true; }
21007 
21008  /**
21009  * \brief Return a copy of the current node
21010  *
21011  * Recursively make a new copy/clone of the current node including
21012  * all members and return a pointer to the node. This is used for
21013  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
21014  * ast.
21015  *
21016  * @return pointer to the clone/copy of the current node
21017  */
21018  Model *clone() const override { return new Model(*this); }
21019 
21020  /// \name Getters
21021  /// \{
21022 
21023  /**
21024  * \brief Return type (ast::AstNodeType) of ast node
21025  *
21026  * Every node in the ast has a type defined in ast::AstNodeType and this
21027  * function is used to retrieve the same.
21028  *
21029  * \return ast node type i.e. ast::AstNodeType::MODEL
21030  *
21031  * \sa Ast::get_node_type_name
21032  */
21033  AstNodeType get_node_type() const noexcept override {
21034  return AstNodeType::MODEL;
21035  }
21036 
21037  /**
21038  * \brief Return type (ast::AstNodeType) of ast node as std::string
21039  *
21040  * Every node in the ast has a type defined in ast::AstNodeType.
21041  * This type name can be returned as a std::string for printing
21042  * node to text/json form.
21043  *
21044  * \return name of the node type as a string i.e. "Model"
21045  *
21046  * \sa Ast::get_node_name
21047  */
21048  std::string get_node_type_name() const noexcept override { return "Model"; }
21049 
21050  /**
21051  * \brief Return NMODL statement of ast node as std::string
21052  *
21053  * Every node is related to a special statement in the NMODL. This
21054  * statement can be returned as a std::string for printing to
21055  * text/json form.
21056  *
21057  * \return name of the statement as a string i.e. "TITLE"
21058  *
21059  * \sa Ast::get_nmodl_name
21060  */
21061  std::string get_nmodl_name() const noexcept override { return "TITLE"; }
21062 
21063  /**
21064  * \brief Get std::shared_ptr from `this` pointer of the current ast node
21065  */
21066  std::shared_ptr<Ast> get_shared_ptr() override {
21067  return std::static_pointer_cast<Model>(shared_from_this());
21068  }
21069 
21070  /**
21071  * \brief Get std::shared_ptr from `this` pointer of the current ast node
21072  */
21073  std::shared_ptr<const Ast> get_shared_ptr() const override {
21074  return std::static_pointer_cast<const Model>(shared_from_this());
21075  }
21076 
21077  /**
21078  * \brief Return associated token for the current ast node
21079  *
21080  * Not all ast nodes have token information. For example,
21081  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
21082  * solution of ODEs. In this case, we return nullptr to store in the
21083  * nmodl::symtab::SymbolTable.
21084  *
21085  * \return pointer to token if exist otherwise nullptr
21086  */
21087  const ModToken *get_token() const noexcept override { return token.get(); }
21088 
21089  /**
21090  * \brief Getter for member variable \ref Model.title
21091  */
21092  const std::shared_ptr<String> &get_title() const noexcept { return title; }
21093 
21094  /// \}
21095 
21096  /// \name Setters
21097  /// \{
21098 
21099  /**
21100  * \brief Set token for the current ast node
21101  */
21102  void set_token(const ModToken &tok) {
21103  token = std::make_shared<ModToken>(tok);
21104  }
21105 
21106  /**
21107  * \brief Setter for member variable \ref Model.title (rvalue reference)
21108  */
21109  void set_title(std::shared_ptr<String> &&title);
21110 
21111  /**
21112  * \brief Setter for member variable \ref Model.title
21113  */
21114  void set_title(const std::shared_ptr<String> &title);
21115 
21116  /// \}
21117 
21118  /// \name Visitor
21119  /// \{
21120 
21121  /**
21122  * \brief visit children i.e. member variables of current node using provided
21123  * visitor
21124  *
21125  * Different nodes in the AST have different members (i.e. children). This
21126  * method recursively visits children using provided visitor.
21127  *
21128  * \param v Concrete visitor that will be used to recursively visit children
21129  *
21130  * \sa Ast::visit_children for example.
21131  */
21132  void visit_children(visitor::Visitor &v) override;
21133 
21134  /**
21135  * \brief visit children i.e. member variables of current node using provided
21136  * visitor
21137  *
21138  * Different nodes in the AST have different members (i.e. children). This
21139  * method recursively visits children using provided visitor.
21140  *
21141  * \param v Concrete constant visitor that will be used to recursively visit
21142  * children
21143  *
21144  * \sa Ast::visit_children for example.
21145  */
21146  void visit_children(visitor::ConstVisitor &v) const override;
21147 
21148  /**
21149  * \brief accept (or visit) the current AST node using provided visitor
21150  *
21151  * Instead of visiting children of AST node, like Ast::visit_children,
21152  * accept allows to visit the current node itself using provided concrete
21153  * visitor.
21154  *
21155  * \param v Concrete visitor that will be used to recursively visit node
21156  *
21157  * \sa Ast::accept for example.
21158  */
21159  void accept(visitor::Visitor &v) override;
21160 
21161  /**
21162  * \copydoc accept(visitor::Visitor&)
21163  */
21164  void accept(visitor::ConstVisitor &v) const override;
21165 
21166  /// \}
21167 
21168 private:
21169  /**
21170  * \brief Set this object as parent for all the children
21171  *
21172  * This should be called in every object (with children) constructor
21173  * to set parents. Since it is called only in the constructors it
21174  * should not be virtual to avoid ambiguities (issue #295).
21175  */
21176  void set_parent_in_children();
21177 };
21178 
21179 /** @} */ // end of ast_class
21180 
21181 } // namespace ast
21182 } // namespace nmodl
21183 #endif // !NMODL_AST_MODEL_HPP
21184 #ifndef NMODL_AST_DEFINE_HPP
21185 #define NMODL_AST_DEFINE_HPP
21186 
21187 namespace nmodl {
21188 namespace ast {
21189 
21190 /**
21191  * @addtogroup ast_class
21192  * @ingroup ast
21193  * @{
21194  */
21195 
21196 /**
21197  * \brief Represents a `DEFINE` statement in NMODL
21198  *
21199  *
21200  */
21201 class Define : public Statement {
21202 private:
21203  /// Name of the macro
21204  std::shared_ptr<Name> name;
21205  /// Value of the macro
21206  std::shared_ptr<Integer> value;
21207  /// token with location information
21208  std::shared_ptr<ModToken> token;
21209 
21210 public:
21211  /// \name Ctor & dtor
21212  /// \{
21213 
21214  explicit Define(Name *name, Integer *value);
21215  explicit Define(const std::shared_ptr<Name> &name,
21216  const std::shared_ptr<Integer> &value);
21217  Define(const Define &obj);
21218 
21219  virtual ~Define() = default;
21220 
21221  /// \}
21222 
21223  /**
21224  * \brief Check if the ast node is an instance of ast::Define
21225  * \return true as object is of type ast::Define
21226  */
21227  bool is_define() const noexcept override { return true; }
21228 
21229  /**
21230  * \brief Return a copy of the current node
21231  *
21232  * Recursively make a new copy/clone of the current node including
21233  * all members and return a pointer to the node. This is used for
21234  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
21235  * ast.
21236  *
21237  * @return pointer to the clone/copy of the current node
21238  */
21239  Define *clone() const override { return new Define(*this); }
21240 
21241  /// \name Getters
21242  /// \{
21243 
21244  /**
21245  * \brief Return type (ast::AstNodeType) of ast node
21246  *
21247  * Every node in the ast has a type defined in ast::AstNodeType and this
21248  * function is used to retrieve the same.
21249  *
21250  * \return ast node type i.e. ast::AstNodeType::DEFINE
21251  *
21252  * \sa Ast::get_node_type_name
21253  */
21254  AstNodeType get_node_type() const noexcept override {
21255  return AstNodeType::DEFINE;
21256  }
21257 
21258  /**
21259  * \brief Return type (ast::AstNodeType) of ast node as std::string
21260  *
21261  * Every node in the ast has a type defined in ast::AstNodeType.
21262  * This type name can be returned as a std::string for printing
21263  * node to text/json form.
21264  *
21265  * \return name of the node type as a string i.e. "Define"
21266  *
21267  * \sa Ast::get_node_name
21268  */
21269  std::string get_node_type_name() const noexcept override { return "Define"; }
21270 
21271  /**
21272  * \brief Return NMODL statement of ast node as std::string
21273  *
21274  * Every node is related to a special statement in the NMODL. This
21275  * statement can be returned as a std::string for printing to
21276  * text/json form.
21277  *
21278  * \return name of the statement as a string i.e. "DEFINE "
21279  *
21280  * \sa Ast::get_nmodl_name
21281  */
21282  std::string get_nmodl_name() const noexcept override { return "DEFINE "; }
21283 
21284  /**
21285  * \brief Get std::shared_ptr from `this` pointer of the current ast node
21286  */
21287  std::shared_ptr<Ast> get_shared_ptr() override {
21288  return std::static_pointer_cast<Define>(shared_from_this());
21289  }
21290 
21291  /**
21292  * \brief Get std::shared_ptr from `this` pointer of the current ast node
21293  */
21294  std::shared_ptr<const Ast> get_shared_ptr() const override {
21295  return std::static_pointer_cast<const Define>(shared_from_this());
21296  }
21297 
21298  /**
21299  * \brief Return associated token for the current ast node
21300  *
21301  * Not all ast nodes have token information. For example,
21302  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
21303  * solution of ODEs. In this case, we return nullptr to store in the
21304  * nmodl::symtab::SymbolTable.
21305  *
21306  * \return pointer to token if exist otherwise nullptr
21307  */
21308  const ModToken *get_token() const noexcept override { return token.get(); }
21309 
21310  /**
21311  * \brief Return name of the node
21312  *
21313  * Some ast nodes have a member marked designated as node name. For example,
21314  * in case of this ast::Name has name designated as a
21315  * node name.
21316  *
21317  * @return name of the node as std::string
21318  *
21319  * \sa Ast::get_node_type_name
21320  */
21321  std::string get_node_name() const override;
21322 
21323  /**
21324  * \brief Getter for member variable \ref Define.name
21325  */
21326  const std::shared_ptr<Name> &get_name() const noexcept { return name; }
21327 
21328  /**
21329  * \brief Getter for member variable \ref Define.value
21330  */
21331  const std::shared_ptr<Integer> &get_value() const noexcept { return value; }
21332 
21333  /// \}
21334 
21335  /// \name Setters
21336  /// \{
21337 
21338  /**
21339  * \brief Set token for the current ast node
21340  */
21341  void set_token(const ModToken &tok) {
21342  token = std::make_shared<ModToken>(tok);
21343  }
21344 
21345  /**
21346  * \brief Setter for member variable \ref Define.name (rvalue reference)
21347  */
21348  void set_name(std::shared_ptr<Name> &&name);
21349 
21350  /**
21351  * \brief Setter for member variable \ref Define.name
21352  */
21353  void set_name(const std::shared_ptr<Name> &name);
21354 
21355  /**
21356  * \brief Setter for member variable \ref Define.value (rvalue reference)
21357  */
21358  void set_value(std::shared_ptr<Integer> &&value);
21359 
21360  /**
21361  * \brief Setter for member variable \ref Define.value
21362  */
21363  void set_value(const std::shared_ptr<Integer> &value);
21364 
21365  /// \}
21366 
21367  /// \name Visitor
21368  /// \{
21369 
21370  /**
21371  * \brief visit children i.e. member variables of current node using provided
21372  * visitor
21373  *
21374  * Different nodes in the AST have different members (i.e. children). This
21375  * method recursively visits children using provided visitor.
21376  *
21377  * \param v Concrete visitor that will be used to recursively visit children
21378  *
21379  * \sa Ast::visit_children for example.
21380  */
21381  void visit_children(visitor::Visitor &v) override;
21382 
21383  /**
21384  * \brief visit children i.e. member variables of current node using provided
21385  * visitor
21386  *
21387  * Different nodes in the AST have different members (i.e. children). This
21388  * method recursively visits children using provided visitor.
21389  *
21390  * \param v Concrete constant visitor that will be used to recursively visit
21391  * children
21392  *
21393  * \sa Ast::visit_children for example.
21394  */
21395  void visit_children(visitor::ConstVisitor &v) const override;
21396 
21397  /**
21398  * \brief accept (or visit) the current AST node using provided visitor
21399  *
21400  * Instead of visiting children of AST node, like Ast::visit_children,
21401  * accept allows to visit the current node itself using provided concrete
21402  * visitor.
21403  *
21404  * \param v Concrete visitor that will be used to recursively visit node
21405  *
21406  * \sa Ast::accept for example.
21407  */
21408  void accept(visitor::Visitor &v) override;
21409 
21410  /**
21411  * \copydoc accept(visitor::Visitor&)
21412  */
21413  void accept(visitor::ConstVisitor &v) const override;
21414 
21415  /// \}
21416 
21417 private:
21418  /**
21419  * \brief Set this object as parent for all the children
21420  *
21421  * This should be called in every object (with children) constructor
21422  * to set parents. Since it is called only in the constructors it
21423  * should not be virtual to avoid ambiguities (issue #295).
21424  */
21425  void set_parent_in_children();
21426 };
21427 
21428 /** @} */ // end of ast_class
21429 
21430 } // namespace ast
21431 } // namespace nmodl
21432 #endif // !NMODL_AST_DEFINE_HPP
21433 #ifndef NMODL_AST_INCLUDE_HPP
21434 #define NMODL_AST_INCLUDE_HPP
21435 
21436 namespace nmodl {
21437 namespace ast {
21438 
21439 /**
21440  * @addtogroup ast_class
21441  * @ingroup ast
21442  * @{
21443  */
21444 
21445 /**
21446  * \brief Represents an `INCLUDE` statement in NMODL
21447  *
21448  *
21449  */
21450 class Include : public Statement {
21451 private:
21452  /// path to the file to include
21453  std::shared_ptr<String> filename;
21454  /// AST of the included file
21456  /// token with location information
21457  std::shared_ptr<ModToken> token;
21458 
21459 public:
21460  /// \name Ctor & dtor
21461  /// \{
21462 
21463  explicit Include(String *filename, NodeVector blocks);
21464  explicit Include(const std::shared_ptr<String> &filename,
21465  const NodeVector &blocks);
21466  Include(const Include &obj);
21467 
21468  virtual ~Include() = default;
21469 
21470  /// \}
21471 
21472  /**
21473  * \brief Check if the ast node is an instance of ast::Include
21474  * \return true as object is of type ast::Include
21475  */
21476  bool is_include() const noexcept override { return true; }
21477 
21478  /**
21479  * \brief Return a copy of the current node
21480  *
21481  * Recursively make a new copy/clone of the current node including
21482  * all members and return a pointer to the node. This is used for
21483  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
21484  * ast.
21485  *
21486  * @return pointer to the clone/copy of the current node
21487  */
21488  Include *clone() const override { return new Include(*this); }
21489 
21490  /// \name Getters
21491  /// \{
21492 
21493  /**
21494  * \brief Return type (ast::AstNodeType) of ast node
21495  *
21496  * Every node in the ast has a type defined in ast::AstNodeType and this
21497  * function is used to retrieve the same.
21498  *
21499  * \return ast node type i.e. ast::AstNodeType::INCLUDE
21500  *
21501  * \sa Ast::get_node_type_name
21502  */
21503  AstNodeType get_node_type() const noexcept override {
21504  return AstNodeType::INCLUDE;
21505  }
21506 
21507  /**
21508  * \brief Return type (ast::AstNodeType) of ast node as std::string
21509  *
21510  * Every node in the ast has a type defined in ast::AstNodeType.
21511  * This type name can be returned as a std::string for printing
21512  * node to text/json form.
21513  *
21514  * \return name of the node type as a string i.e. "Include"
21515  *
21516  * \sa Ast::get_node_name
21517  */
21518  std::string get_node_type_name() const noexcept override { return "Include"; }
21519 
21520  /**
21521  * \brief Return NMODL statement of ast node as std::string
21522  *
21523  * Every node is related to a special statement in the NMODL. This
21524  * statement can be returned as a std::string for printing to
21525  * text/json form.
21526  *
21527  * \return name of the statement as a string i.e. "INCLUDE "
21528  *
21529  * \sa Ast::get_nmodl_name
21530  */
21531  std::string get_nmodl_name() const noexcept override { return "INCLUDE "; }
21532 
21533  /**
21534  * \brief Get std::shared_ptr from `this` pointer of the current ast node
21535  */
21536  std::shared_ptr<Ast> get_shared_ptr() override {
21537  return std::static_pointer_cast<Include>(shared_from_this());
21538  }
21539 
21540  /**
21541  * \brief Get std::shared_ptr from `this` pointer of the current ast node
21542  */
21543  std::shared_ptr<const Ast> get_shared_ptr() const override {
21544  return std::static_pointer_cast<const Include>(shared_from_this());
21545  }
21546 
21547  /**
21548  * \brief Return associated token for the current ast node
21549  *
21550  * Not all ast nodes have token information. For example,
21551  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
21552  * solution of ODEs. In this case, we return nullptr to store in the
21553  * nmodl::symtab::SymbolTable.
21554  *
21555  * \return pointer to token if exist otherwise nullptr
21556  */
21557  const ModToken *get_token() const noexcept override { return token.get(); }
21558 
21559  /**
21560  * \brief Getter for member variable \ref Include.filename
21561  */
21562  const std::shared_ptr<String> &get_filename() const noexcept {
21563  return filename;
21564  }
21565 
21566  /**
21567  * \brief Getter for member variable \ref Include.blocks
21568  */
21569  const NodeVector &get_blocks() const noexcept { return blocks; }
21570 
21571  /// \}
21572 
21573  /// \name Setters
21574  /// \{
21575 
21576  /**
21577  * \brief Set token for the current ast node
21578  */
21579  void set_token(const ModToken &tok) {
21580  token = std::make_shared<ModToken>(tok);
21581  }
21582 
21583  /**
21584  * \brief Setter for member variable \ref Include.filename (rvalue reference)
21585  */
21586  void set_filename(std::shared_ptr<String> &&filename);
21587 
21588  /**
21589  * \brief Setter for member variable \ref Include.filename
21590  */
21591  void set_filename(const std::shared_ptr<String> &filename);
21592 
21593  /**
21594  * \brief Setter for member variable \ref Include.blocks (rvalue reference)
21595  */
21596  void set_blocks(NodeVector &&blocks);
21597 
21598  /**
21599  * \brief Setter for member variable \ref Include.blocks
21600  */
21601  void set_blocks(const NodeVector &blocks);
21602 
21603  /// \}
21604 
21605  /// \name Visitor
21606  /// \{
21607 
21608  /**
21609  * \brief visit children i.e. member variables of current node using provided
21610  * visitor
21611  *
21612  * Different nodes in the AST have different members (i.e. children). This
21613  * method recursively visits children using provided visitor.
21614  *
21615  * \param v Concrete visitor that will be used to recursively visit children
21616  *
21617  * \sa Ast::visit_children for example.
21618  */
21619  void visit_children(visitor::Visitor &v) override;
21620 
21621  /**
21622  * \brief visit children i.e. member variables of current node using provided
21623  * visitor
21624  *
21625  * Different nodes in the AST have different members (i.e. children). This
21626  * method recursively visits children using provided visitor.
21627  *
21628  * \param v Concrete constant visitor that will be used to recursively visit
21629  * children
21630  *
21631  * \sa Ast::visit_children for example.
21632  */
21633  void visit_children(visitor::ConstVisitor &v) const override;
21634 
21635  /**
21636  * \brief accept (or visit) the current AST node using provided visitor
21637  *
21638  * Instead of visiting children of AST node, like Ast::visit_children,
21639  * accept allows to visit the current node itself using provided concrete
21640  * visitor.
21641  *
21642  * \param v Concrete visitor that will be used to recursively visit node
21643  *
21644  * \sa Ast::accept for example.
21645  */
21646  void accept(visitor::Visitor &v) override;
21647 
21648  /**
21649  * \copydoc accept(visitor::Visitor&)
21650  */
21651  void accept(visitor::ConstVisitor &v) const override;
21652 
21653  /// \}
21654 
21655 private:
21656  /**
21657  * \brief Set this object as parent for all the children
21658  *
21659  * This should be called in every object (with children) constructor
21660  * to set parents. Since it is called only in the constructors it
21661  * should not be virtual to avoid ambiguities (issue #295).
21662  */
21663  void set_parent_in_children();
21664 };
21665 
21666 /** @} */ // end of ast_class
21667 
21668 } // namespace ast
21669 } // namespace nmodl
21670 #endif // !NMODL_AST_INCLUDE_HPP
21671 #ifndef NMODL_AST_PARAM_ASSIGN_HPP
21672 #define NMODL_AST_PARAM_ASSIGN_HPP
21673 
21674 namespace nmodl {
21675 namespace ast {
21676 
21677 /**
21678  * @addtogroup ast_class
21679  * @ingroup ast
21680  * @{
21681  */
21682 
21683 /**
21684  * \brief TODO
21685  *
21686  *
21687  */
21688 class ParamAssign : public Statement {
21689 private:
21690  /// TODO
21691  std::shared_ptr<Identifier> name;
21692  /// TODO
21693  std::shared_ptr<Number> value;
21694  /// TODO
21695  std::shared_ptr<Unit> unit;
21696  /// TODO
21697  std::shared_ptr<Limits> limit;
21698  /// token with location information
21699  std::shared_ptr<ModToken> token;
21700 
21701 public:
21702  /// \name Ctor & dtor
21703  /// \{
21704 
21705  explicit ParamAssign(Identifier *name, Number *value, Unit *unit,
21706  Limits *limit);
21707  explicit ParamAssign(const std::shared_ptr<Identifier> &name,
21708  const std::shared_ptr<Number> &value,
21709  const std::shared_ptr<Unit> &unit,
21710  const std::shared_ptr<Limits> &limit);
21711  ParamAssign(const ParamAssign &obj);
21712 
21713  virtual ~ParamAssign() = default;
21714 
21715  /// \}
21716 
21717  /**
21718  * \brief Check if the ast node is an instance of ast::ParamAssign
21719  * \return true as object is of type ast::ParamAssign
21720  */
21721  bool is_param_assign() const noexcept override { return true; }
21722 
21723  /**
21724  * \brief Return a copy of the current node
21725  *
21726  * Recursively make a new copy/clone of the current node including
21727  * all members and return a pointer to the node. This is used for
21728  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
21729  * ast.
21730  *
21731  * @return pointer to the clone/copy of the current node
21732  */
21733  ParamAssign *clone() const override { return new ParamAssign(*this); }
21734 
21735  /// \name Getters
21736  /// \{
21737 
21738  /**
21739  * \brief Return type (ast::AstNodeType) of ast node
21740  *
21741  * Every node in the ast has a type defined in ast::AstNodeType and this
21742  * function is used to retrieve the same.
21743  *
21744  * \return ast node type i.e. ast::AstNodeType::PARAM_ASSIGN
21745  *
21746  * \sa Ast::get_node_type_name
21747  */
21748  AstNodeType get_node_type() const noexcept override {
21750  }
21751 
21752  /**
21753  * \brief Return type (ast::AstNodeType) of ast node as std::string
21754  *
21755  * Every node in the ast has a type defined in ast::AstNodeType.
21756  * This type name can be returned as a std::string for printing
21757  * node to text/json form.
21758  *
21759  * \return name of the node type as a string i.e. "ParamAssign"
21760  *
21761  * \sa Ast::get_node_name
21762  */
21763  std::string get_node_type_name() const noexcept override {
21764  return "ParamAssign";
21765  }
21766 
21767  /**
21768  * \brief Get std::shared_ptr from `this` pointer of the current ast node
21769  */
21770  std::shared_ptr<Ast> get_shared_ptr() override {
21771  return std::static_pointer_cast<ParamAssign>(shared_from_this());
21772  }
21773 
21774  /**
21775  * \brief Get std::shared_ptr from `this` pointer of the current ast node
21776  */
21777  std::shared_ptr<const Ast> get_shared_ptr() const override {
21778  return std::static_pointer_cast<const ParamAssign>(shared_from_this());
21779  }
21780 
21781  /**
21782  * \brief Return associated token for the current ast node
21783  *
21784  * Not all ast nodes have token information. For example,
21785  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
21786  * solution of ODEs. In this case, we return nullptr to store in the
21787  * nmodl::symtab::SymbolTable.
21788  *
21789  * \return pointer to token if exist otherwise nullptr
21790  */
21791  const ModToken *get_token() const noexcept override { return token.get(); }
21792 
21793  /**
21794  * \brief Return name of the node
21795  *
21796  * Some ast nodes have a member marked designated as node name. For example,
21797  * in case of this ast::Identifier has name designated as a
21798  * node name.
21799  *
21800  * @return name of the node as std::string
21801  *
21802  * \sa Ast::get_node_type_name
21803  */
21804  std::string get_node_name() const override;
21805 
21806  /**
21807  * \brief Getter for member variable \ref ParamAssign.name
21808  */
21809  const std::shared_ptr<Identifier> &get_name() const noexcept { return name; }
21810 
21811  /**
21812  * \brief Getter for member variable \ref ParamAssign.value
21813  */
21814  const std::shared_ptr<Number> &get_value() const noexcept { return value; }
21815 
21816  /**
21817  * \brief Getter for member variable \ref ParamAssign.unit
21818  */
21819  const std::shared_ptr<Unit> &get_unit() const noexcept { return unit; }
21820 
21821  /**
21822  * \brief Getter for member variable \ref ParamAssign.limit
21823  */
21824  const std::shared_ptr<Limits> &get_limit() const noexcept { return limit; }
21825 
21826  /// \}
21827 
21828  /// \name Setters
21829  /// \{
21830 
21831  /**
21832  * \brief Set token for the current ast node
21833  */
21834  void set_token(const ModToken &tok) {
21835  token = std::make_shared<ModToken>(tok);
21836  }
21837 
21838  /**
21839  * \brief Setter for member variable \ref ParamAssign.name (rvalue reference)
21840  */
21841  void set_name(std::shared_ptr<Identifier> &&name);
21842 
21843  /**
21844  * \brief Setter for member variable \ref ParamAssign.name
21845  */
21846  void set_name(const std::shared_ptr<Identifier> &name);
21847 
21848  /**
21849  * \brief Setter for member variable \ref ParamAssign.value (rvalue reference)
21850  */
21851  void set_value(std::shared_ptr<Number> &&value);
21852 
21853  /**
21854  * \brief Setter for member variable \ref ParamAssign.value
21855  */
21856  void set_value(const std::shared_ptr<Number> &value);
21857 
21858  /**
21859  * \brief Setter for member variable \ref ParamAssign.unit (rvalue reference)
21860  */
21861  void set_unit(std::shared_ptr<Unit> &&unit);
21862 
21863  /**
21864  * \brief Setter for member variable \ref ParamAssign.unit
21865  */
21866  void set_unit(const std::shared_ptr<Unit> &unit);
21867 
21868  /**
21869  * \brief Setter for member variable \ref ParamAssign.limit (rvalue reference)
21870  */
21871  void set_limit(std::shared_ptr<Limits> &&limit);
21872 
21873  /**
21874  * \brief Setter for member variable \ref ParamAssign.limit
21875  */
21876  void set_limit(const std::shared_ptr<Limits> &limit);
21877 
21878  /// \}
21879 
21880  /// \name Visitor
21881  /// \{
21882 
21883  /**
21884  * \brief visit children i.e. member variables of current node using provided
21885  * visitor
21886  *
21887  * Different nodes in the AST have different members (i.e. children). This
21888  * method recursively visits children using provided visitor.
21889  *
21890  * \param v Concrete visitor that will be used to recursively visit children
21891  *
21892  * \sa Ast::visit_children for example.
21893  */
21894  void visit_children(visitor::Visitor &v) override;
21895 
21896  /**
21897  * \brief visit children i.e. member variables of current node using provided
21898  * visitor
21899  *
21900  * Different nodes in the AST have different members (i.e. children). This
21901  * method recursively visits children using provided visitor.
21902  *
21903  * \param v Concrete constant visitor that will be used to recursively visit
21904  * children
21905  *
21906  * \sa Ast::visit_children for example.
21907  */
21908  void visit_children(visitor::ConstVisitor &v) const override;
21909 
21910  /**
21911  * \brief accept (or visit) the current AST node using provided visitor
21912  *
21913  * Instead of visiting children of AST node, like Ast::visit_children,
21914  * accept allows to visit the current node itself using provided concrete
21915  * visitor.
21916  *
21917  * \param v Concrete visitor that will be used to recursively visit node
21918  *
21919  * \sa Ast::accept for example.
21920  */
21921  void accept(visitor::Visitor &v) override;
21922 
21923  /**
21924  * \copydoc accept(visitor::Visitor&)
21925  */
21926  void accept(visitor::ConstVisitor &v) const override;
21927 
21928  /// \}
21929 
21930 private:
21931  /**
21932  * \brief Set this object as parent for all the children
21933  *
21934  * This should be called in every object (with children) constructor
21935  * to set parents. Since it is called only in the constructors it
21936  * should not be virtual to avoid ambiguities (issue #295).
21937  */
21938  void set_parent_in_children();
21939 };
21940 
21941 /** @} */ // end of ast_class
21942 
21943 } // namespace ast
21944 } // namespace nmodl
21945 #endif // !NMODL_AST_PARAM_ASSIGN_HPP
21946 #ifndef NMODL_AST_STEPPED_HPP
21947 #define NMODL_AST_STEPPED_HPP
21948 
21949 namespace nmodl {
21950 namespace ast {
21951 
21952 /**
21953  * @addtogroup ast_class
21954  * @ingroup ast
21955  * @{
21956  */
21957 
21958 /**
21959  * \brief TODO
21960  *
21961  *
21962  */
21963 class Stepped : public Statement {
21964 private:
21965  /// TODO
21966  std::shared_ptr<Name> name;
21967  /// TODO
21969  /// TODO
21970  std::shared_ptr<Unit> unit;
21971  /// token with location information
21972  std::shared_ptr<ModToken> token;
21973 
21974 public:
21975  /// \name Ctor & dtor
21976  /// \{
21977 
21978  explicit Stepped(Name *name, NumberVector values, Unit *unit);
21979  explicit Stepped(const std::shared_ptr<Name> &name,
21980  const NumberVector &values,
21981  const std::shared_ptr<Unit> &unit);
21982  Stepped(const Stepped &obj);
21983 
21984  virtual ~Stepped() = default;
21985 
21986  /// \}
21987 
21988  /**
21989  * \brief Check if the ast node is an instance of ast::Stepped
21990  * \return true as object is of type ast::Stepped
21991  */
21992  bool is_stepped() const noexcept override { return true; }
21993 
21994  /**
21995  * \brief Return a copy of the current node
21996  *
21997  * Recursively make a new copy/clone of the current node including
21998  * all members and return a pointer to the node. This is used for
21999  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
22000  * ast.
22001  *
22002  * @return pointer to the clone/copy of the current node
22003  */
22004  Stepped *clone() const override { return new Stepped(*this); }
22005 
22006  /// \name Getters
22007  /// \{
22008 
22009  /**
22010  * \brief Return type (ast::AstNodeType) of ast node
22011  *
22012  * Every node in the ast has a type defined in ast::AstNodeType and this
22013  * function is used to retrieve the same.
22014  *
22015  * \return ast node type i.e. ast::AstNodeType::STEPPED
22016  *
22017  * \sa Ast::get_node_type_name
22018  */
22019  AstNodeType get_node_type() const noexcept override {
22020  return AstNodeType::STEPPED;
22021  }
22022 
22023  /**
22024  * \brief Return type (ast::AstNodeType) of ast node as std::string
22025  *
22026  * Every node in the ast has a type defined in ast::AstNodeType.
22027  * This type name can be returned as a std::string for printing
22028  * node to text/json form.
22029  *
22030  * \return name of the node type as a string i.e. "Stepped"
22031  *
22032  * \sa Ast::get_node_name
22033  */
22034  std::string get_node_type_name() const noexcept override { return "Stepped"; }
22035 
22036  /**
22037  * \brief Get std::shared_ptr from `this` pointer of the current ast node
22038  */
22039  std::shared_ptr<Ast> get_shared_ptr() override {
22040  return std::static_pointer_cast<Stepped>(shared_from_this());
22041  }
22042 
22043  /**
22044  * \brief Get std::shared_ptr from `this` pointer of the current ast node
22045  */
22046  std::shared_ptr<const Ast> get_shared_ptr() const override {
22047  return std::static_pointer_cast<const Stepped>(shared_from_this());
22048  }
22049 
22050  /**
22051  * \brief Return associated token for the current ast node
22052  *
22053  * Not all ast nodes have token information. For example,
22054  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
22055  * solution of ODEs. In this case, we return nullptr to store in the
22056  * nmodl::symtab::SymbolTable.
22057  *
22058  * \return pointer to token if exist otherwise nullptr
22059  */
22060  const ModToken *get_token() const noexcept override { return token.get(); }
22061 
22062  /**
22063  * \brief Getter for member variable \ref Stepped.name
22064  */
22065  const std::shared_ptr<Name> &get_name() const noexcept { return name; }
22066 
22067  /**
22068  * \brief Getter for member variable \ref Stepped.values
22069  */
22070  const NumberVector &get_values() const noexcept { return values; }
22071 
22072  /**
22073  * \brief Getter for member variable \ref Stepped.unit
22074  */
22075  const std::shared_ptr<Unit> &get_unit() const noexcept { return unit; }
22076 
22077  /// \}
22078 
22079  /// \name Setters
22080  /// \{
22081 
22082  /**
22083  * \brief Set token for the current ast node
22084  */
22085  void set_token(const ModToken &tok) {
22086  token = std::make_shared<ModToken>(tok);
22087  }
22088 
22089  /**
22090  * \brief Setter for member variable \ref Stepped.name (rvalue reference)
22091  */
22092  void set_name(std::shared_ptr<Name> &&name);
22093 
22094  /**
22095  * \brief Setter for member variable \ref Stepped.name
22096  */
22097  void set_name(const std::shared_ptr<Name> &name);
22098 
22099  /**
22100  * \brief Setter for member variable \ref Stepped.values (rvalue reference)
22101  */
22102  void set_values(NumberVector &&values);
22103 
22104  /**
22105  * \brief Setter for member variable \ref Stepped.values
22106  */
22107  void set_values(const NumberVector &values);
22108 
22109  /**
22110  * \brief Setter for member variable \ref Stepped.unit (rvalue reference)
22111  */
22112  void set_unit(std::shared_ptr<Unit> &&unit);
22113 
22114  /**
22115  * \brief Setter for member variable \ref Stepped.unit
22116  */
22117  void set_unit(const std::shared_ptr<Unit> &unit);
22118 
22119  /// \}
22120 
22121  /// \name Visitor
22122  /// \{
22123 
22124  /**
22125  * \brief visit children i.e. member variables of current node using provided
22126  * visitor
22127  *
22128  * Different nodes in the AST have different members (i.e. children). This
22129  * method recursively visits children using provided visitor.
22130  *
22131  * \param v Concrete visitor that will be used to recursively visit children
22132  *
22133  * \sa Ast::visit_children for example.
22134  */
22135  void visit_children(visitor::Visitor &v) override;
22136 
22137  /**
22138  * \brief visit children i.e. member variables of current node using provided
22139  * visitor
22140  *
22141  * Different nodes in the AST have different members (i.e. children). This
22142  * method recursively visits children using provided visitor.
22143  *
22144  * \param v Concrete constant visitor that will be used to recursively visit
22145  * children
22146  *
22147  * \sa Ast::visit_children for example.
22148  */
22149  void visit_children(visitor::ConstVisitor &v) const override;
22150 
22151  /**
22152  * \brief accept (or visit) the current AST node using provided visitor
22153  *
22154  * Instead of visiting children of AST node, like Ast::visit_children,
22155  * accept allows to visit the current node itself using provided concrete
22156  * visitor.
22157  *
22158  * \param v Concrete visitor that will be used to recursively visit node
22159  *
22160  * \sa Ast::accept for example.
22161  */
22162  void accept(visitor::Visitor &v) override;
22163 
22164  /**
22165  * \copydoc accept(visitor::Visitor&)
22166  */
22167  void accept(visitor::ConstVisitor &v) const override;
22168 
22169  /// \}
22170 
22171 private:
22172  /**
22173  * \brief Set this object as parent for all the children
22174  *
22175  * This should be called in every object (with children) constructor
22176  * to set parents. Since it is called only in the constructors it
22177  * should not be virtual to avoid ambiguities (issue #295).
22178  */
22179  void set_parent_in_children();
22180 };
22181 
22182 /** @} */ // end of ast_class
22183 
22184 } // namespace ast
22185 } // namespace nmodl
22186 #endif // !NMODL_AST_STEPPED_HPP
22187 #ifndef NMODL_AST_INDEPENDENT_DEFINITION_HPP
22188 #define NMODL_AST_INDEPENDENT_DEFINITION_HPP
22189 
22190 namespace nmodl {
22191 namespace ast {
22192 
22193 /**
22194  * @addtogroup ast_class
22195  * @ingroup ast
22196  * @{
22197  */
22198 
22199 /**
22200  * \brief TODO
22201  *
22202  *
22203  */
22205 private:
22206  /// TODO
22207  std::shared_ptr<Boolean> sweep;
22208  /// TODO
22209  std::shared_ptr<Name> name;
22210  /// TODO
22211  std::shared_ptr<Number> from;
22212  /// TODO
22213  std::shared_ptr<Number> to;
22214  /// TODO
22215  std::shared_ptr<Integer> with;
22216  /// TODO
22217  std::shared_ptr<Number> start;
22218  /// TODO
22219  std::shared_ptr<Unit> unit;
22220  /// token with location information
22221  std::shared_ptr<ModToken> token;
22222 
22223 public:
22224  /// \name Ctor & dtor
22225  /// \{
22226 
22227  explicit IndependentDefinition(Boolean *sweep, Name *name, Number *from,
22228  Number *to, Integer *with, Number *start,
22229  Unit *unit);
22230  explicit IndependentDefinition(const std::shared_ptr<Boolean> &sweep,
22231  const std::shared_ptr<Name> &name,
22232  const std::shared_ptr<Number> &from,
22233  const std::shared_ptr<Number> &to,
22234  const std::shared_ptr<Integer> &with,
22235  const std::shared_ptr<Number> &start,
22236  const std::shared_ptr<Unit> &unit);
22238 
22239  virtual ~IndependentDefinition() = default;
22240 
22241  /// \}
22242 
22243  /**
22244  * \brief Check if the ast node is an instance of ast::IndependentDefinition
22245  * \return true as object is of type ast::IndependentDefinition
22246  */
22247  bool is_independent_definition() const noexcept override { return true; }
22248 
22249  /**
22250  * \brief Return a copy of the current node
22251  *
22252  * Recursively make a new copy/clone of the current node including
22253  * all members and return a pointer to the node. This is used for
22254  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
22255  * ast.
22256  *
22257  * @return pointer to the clone/copy of the current node
22258  */
22259  IndependentDefinition *clone() const override {
22260  return new IndependentDefinition(*this);
22261  }
22262 
22263  /// \name Getters
22264  /// \{
22265 
22266  /**
22267  * \brief Return type (ast::AstNodeType) of ast node
22268  *
22269  * Every node in the ast has a type defined in ast::AstNodeType and this
22270  * function is used to retrieve the same.
22271  *
22272  * \return ast node type i.e. ast::AstNodeType::INDEPENDENT_DEFINITION
22273  *
22274  * \sa Ast::get_node_type_name
22275  */
22276  AstNodeType get_node_type() const noexcept override {
22278  }
22279 
22280  /**
22281  * \brief Return type (ast::AstNodeType) of ast node as std::string
22282  *
22283  * Every node in the ast has a type defined in ast::AstNodeType.
22284  * This type name can be returned as a std::string for printing
22285  * node to text/json form.
22286  *
22287  * \return name of the node type as a string i.e. "IndependentDefinition"
22288  *
22289  * \sa Ast::get_node_name
22290  */
22291  std::string get_node_type_name() const noexcept override {
22292  return "IndependentDefinition";
22293  }
22294 
22295  /**
22296  * \brief Get std::shared_ptr from `this` pointer of the current ast node
22297  */
22298  std::shared_ptr<Ast> get_shared_ptr() override {
22299  return std::static_pointer_cast<IndependentDefinition>(shared_from_this());
22300  }
22301 
22302  /**
22303  * \brief Get std::shared_ptr from `this` pointer of the current ast node
22304  */
22305  std::shared_ptr<const Ast> get_shared_ptr() const override {
22306  return std::static_pointer_cast<const IndependentDefinition>(
22307  shared_from_this());
22308  }
22309 
22310  /**
22311  * \brief Return associated token for the current ast node
22312  *
22313  * Not all ast nodes have token information. For example,
22314  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
22315  * solution of ODEs. In this case, we return nullptr to store in the
22316  * nmodl::symtab::SymbolTable.
22317  *
22318  * \return pointer to token if exist otherwise nullptr
22319  */
22320  const ModToken *get_token() const noexcept override { return token.get(); }
22321 
22322  /**
22323  * \brief Getter for member variable \ref IndependentDefinition.sweep
22324  */
22325  const std::shared_ptr<Boolean> &get_sweep() const noexcept { return sweep; }
22326 
22327  /**
22328  * \brief Getter for member variable \ref IndependentDefinition.name
22329  */
22330  const std::shared_ptr<Name> &get_name() const noexcept { return name; }
22331 
22332  /**
22333  * \brief Getter for member variable \ref IndependentDefinition.from
22334  */
22335  const std::shared_ptr<Number> &get_from() const noexcept { return from; }
22336 
22337  /**
22338  * \brief Getter for member variable \ref IndependentDefinition.to
22339  */
22340  const std::shared_ptr<Number> &get_to() const noexcept { return to; }
22341 
22342  /**
22343  * \brief Getter for member variable \ref IndependentDefinition.with
22344  */
22345  const std::shared_ptr<Integer> &get_with() const noexcept { return with; }
22346 
22347  /**
22348  * \brief Getter for member variable \ref IndependentDefinition.start
22349  */
22350  const std::shared_ptr<Number> &get_start() const noexcept { return start; }
22351 
22352  /**
22353  * \brief Getter for member variable \ref IndependentDefinition.unit
22354  */
22355  const std::shared_ptr<Unit> &get_unit() const noexcept { return unit; }
22356 
22357  /// \}
22358 
22359  /// \name Setters
22360  /// \{
22361 
22362  /**
22363  * \brief Set token for the current ast node
22364  */
22365  void set_token(const ModToken &tok) {
22366  token = std::make_shared<ModToken>(tok);
22367  }
22368 
22369  /**
22370  * \brief Setter for member variable \ref IndependentDefinition.sweep (rvalue
22371  * reference)
22372  */
22373  void set_sweep(std::shared_ptr<Boolean> &&sweep);
22374 
22375  /**
22376  * \brief Setter for member variable \ref IndependentDefinition.sweep
22377  */
22378  void set_sweep(const std::shared_ptr<Boolean> &sweep);
22379 
22380  /**
22381  * \brief Setter for member variable \ref IndependentDefinition.name (rvalue
22382  * reference)
22383  */
22384  void set_name(std::shared_ptr<Name> &&name);
22385 
22386  /**
22387  * \brief Setter for member variable \ref IndependentDefinition.name
22388  */
22389  void set_name(const std::shared_ptr<Name> &name);
22390 
22391  /**
22392  * \brief Setter for member variable \ref IndependentDefinition.from (rvalue
22393  * reference)
22394  */
22395  void set_from(std::shared_ptr<Number> &&from);
22396 
22397  /**
22398  * \brief Setter for member variable \ref IndependentDefinition.from
22399  */
22400  void set_from(const std::shared_ptr<Number> &from);
22401 
22402  /**
22403  * \brief Setter for member variable \ref IndependentDefinition.to (rvalue
22404  * reference)
22405  */
22406  void set_to(std::shared_ptr<Number> &&to);
22407 
22408  /**
22409  * \brief Setter for member variable \ref IndependentDefinition.to
22410  */
22411  void set_to(const std::shared_ptr<Number> &to);
22412 
22413  /**
22414  * \brief Setter for member variable \ref IndependentDefinition.with (rvalue
22415  * reference)
22416  */
22417  void set_with(std::shared_ptr<Integer> &&with);
22418 
22419  /**
22420  * \brief Setter for member variable \ref IndependentDefinition.with
22421  */
22422  void set_with(const std::shared_ptr<Integer> &with);
22423 
22424  /**
22425  * \brief Setter for member variable \ref IndependentDefinition.start (rvalue
22426  * reference)
22427  */
22428  void set_start(std::shared_ptr<Number> &&start);
22429 
22430  /**
22431  * \brief Setter for member variable \ref IndependentDefinition.start
22432  */
22433  void set_start(const std::shared_ptr<Number> &start);
22434 
22435  /**
22436  * \brief Setter for member variable \ref IndependentDefinition.unit (rvalue
22437  * reference)
22438  */
22439  void set_unit(std::shared_ptr<Unit> &&unit);
22440 
22441  /**
22442  * \brief Setter for member variable \ref IndependentDefinition.unit
22443  */
22444  void set_unit(const std::shared_ptr<Unit> &unit);
22445 
22446  /// \}
22447 
22448  /// \name Visitor
22449  /// \{
22450 
22451  /**
22452  * \brief visit children i.e. member variables of current node using provided
22453  * visitor
22454  *
22455  * Different nodes in the AST have different members (i.e. children). This
22456  * method recursively visits children using provided visitor.
22457  *
22458  * \param v Concrete visitor that will be used to recursively visit children
22459  *
22460  * \sa Ast::visit_children for example.
22461  */
22462  void visit_children(visitor::Visitor &v) override;
22463 
22464  /**
22465  * \brief visit children i.e. member variables of current node using provided
22466  * visitor
22467  *
22468  * Different nodes in the AST have different members (i.e. children). This
22469  * method recursively visits children using provided visitor.
22470  *
22471  * \param v Concrete constant visitor that will be used to recursively visit
22472  * children
22473  *
22474  * \sa Ast::visit_children for example.
22475  */
22476  void visit_children(visitor::ConstVisitor &v) const override;
22477 
22478  /**
22479  * \brief accept (or visit) the current AST node using provided visitor
22480  *
22481  * Instead of visiting children of AST node, like Ast::visit_children,
22482  * accept allows to visit the current node itself using provided concrete
22483  * visitor.
22484  *
22485  * \param v Concrete visitor that will be used to recursively visit node
22486  *
22487  * \sa Ast::accept for example.
22488  */
22489  void accept(visitor::Visitor &v) override;
22490 
22491  /**
22492  * \copydoc accept(visitor::Visitor&)
22493  */
22494  void accept(visitor::ConstVisitor &v) const override;
22495 
22496  /// \}
22497 
22498 private:
22499  /**
22500  * \brief Set this object as parent for all the children
22501  *
22502  * This should be called in every object (with children) constructor
22503  * to set parents. Since it is called only in the constructors it
22504  * should not be virtual to avoid ambiguities (issue #295).
22505  */
22506  void set_parent_in_children();
22507 };
22508 
22509 /** @} */ // end of ast_class
22510 
22511 } // namespace ast
22512 } // namespace nmodl
22513 #endif // !NMODL_AST_INDEPENDENT_DEFINITION_HPP
22514 #ifndef NMODL_AST_ASSIGNED_DEFINITION_HPP
22515 #define NMODL_AST_ASSIGNED_DEFINITION_HPP
22516 
22517 namespace nmodl {
22518 namespace ast {
22519 
22520 /**
22521  * @addtogroup ast_class
22522  * @ingroup ast
22523  * @{
22524  */
22525 
22526 /**
22527  * \brief Represents a statement in `ASSIGNED` or `STATE` block
22528  *
22529  *
22530  */
22532 private:
22533  /// Name of the variable
22534  std::shared_ptr<Identifier> name;
22535  /// Length in case of array
22536  std::shared_ptr<Integer> length;
22537  /// TODO
22538  std::shared_ptr<Number> from;
22539  /// TODO
22540  std::shared_ptr<Number> to;
22541  /// TODO
22542  std::shared_ptr<Number> start;
22543  /// TODO
22544  std::shared_ptr<Unit> unit;
22545  /// TODO
22546  std::shared_ptr<Double> abstol;
22547  /// token with location information
22548  std::shared_ptr<ModToken> token;
22549 
22550 public:
22551  /// \name Ctor & dtor
22552  /// \{
22553 
22554  explicit AssignedDefinition(Identifier *name, Integer *length, Number *from,
22555  Number *to, Number *start, Unit *unit,
22556  Double *abstol);
22557  explicit AssignedDefinition(const std::shared_ptr<Identifier> &name,
22558  const std::shared_ptr<Integer> &length,
22559  const std::shared_ptr<Number> &from,
22560  const std::shared_ptr<Number> &to,
22561  const std::shared_ptr<Number> &start,
22562  const std::shared_ptr<Unit> &unit,
22563  const std::shared_ptr<Double> &abstol);
22565 
22566  virtual ~AssignedDefinition() = default;
22567 
22568  /// \}
22569 
22570  /**
22571  * \brief Check if the ast node is an instance of ast::AssignedDefinition
22572  * \return true as object is of type ast::AssignedDefinition
22573  */
22574  bool is_assigned_definition() const noexcept override { return true; }
22575 
22576  /**
22577  * \brief Return a copy of the current node
22578  *
22579  * Recursively make a new copy/clone of the current node including
22580  * all members and return a pointer to the node. This is used for
22581  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
22582  * ast.
22583  *
22584  * @return pointer to the clone/copy of the current node
22585  */
22586  AssignedDefinition *clone() const override {
22587  return new AssignedDefinition(*this);
22588  }
22589 
22590  /// \name Getters
22591  /// \{
22592 
22593  /**
22594  * \brief Return type (ast::AstNodeType) of ast node
22595  *
22596  * Every node in the ast has a type defined in ast::AstNodeType and this
22597  * function is used to retrieve the same.
22598  *
22599  * \return ast node type i.e. ast::AstNodeType::ASSIGNED_DEFINITION
22600  *
22601  * \sa Ast::get_node_type_name
22602  */
22603  AstNodeType get_node_type() const noexcept override {
22605  }
22606 
22607  /**
22608  * \brief Return type (ast::AstNodeType) of ast node as std::string
22609  *
22610  * Every node in the ast has a type defined in ast::AstNodeType.
22611  * This type name can be returned as a std::string for printing
22612  * node to text/json form.
22613  *
22614  * \return name of the node type as a string i.e. "AssignedDefinition"
22615  *
22616  * \sa Ast::get_node_name
22617  */
22618  std::string get_node_type_name() const noexcept override {
22619  return "AssignedDefinition";
22620  }
22621 
22622  /**
22623  * \brief Get std::shared_ptr from `this` pointer of the current ast node
22624  */
22625  std::shared_ptr<Ast> get_shared_ptr() override {
22626  return std::static_pointer_cast<AssignedDefinition>(shared_from_this());
22627  }
22628 
22629  /**
22630  * \brief Get std::shared_ptr from `this` pointer of the current ast node
22631  */
22632  std::shared_ptr<const Ast> get_shared_ptr() const override {
22633  return std::static_pointer_cast<const AssignedDefinition>(
22634  shared_from_this());
22635  }
22636 
22637  /**
22638  * \brief Return associated token for the current ast node
22639  *
22640  * Not all ast nodes have token information. For example,
22641  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
22642  * solution of ODEs. In this case, we return nullptr to store in the
22643  * nmodl::symtab::SymbolTable.
22644  *
22645  * \return pointer to token if exist otherwise nullptr
22646  */
22647  const ModToken *get_token() const noexcept override { return token.get(); }
22648 
22649  /**
22650  * \brief Return name of the node
22651  *
22652  * Some ast nodes have a member marked designated as node name. For example,
22653  * in case of this ast::Identifier has name designated as a
22654  * node name.
22655  *
22656  * @return name of the node as std::string
22657  *
22658  * \sa Ast::get_node_type_name
22659  */
22660  std::string get_node_name() const override;
22661 
22662  /**
22663  * \brief Getter for member variable \ref AssignedDefinition.name
22664  */
22665  const std::shared_ptr<Identifier> &get_name() const noexcept { return name; }
22666 
22667  /**
22668  * \brief Getter for member variable \ref AssignedDefinition.length
22669  */
22670  const std::shared_ptr<Integer> &get_length() const noexcept { return length; }
22671 
22672  /**
22673  * \brief Getter for member variable \ref AssignedDefinition.from
22674  */
22675  const std::shared_ptr<Number> &get_from() const noexcept { return from; }
22676 
22677  /**
22678  * \brief Getter for member variable \ref AssignedDefinition.to
22679  */
22680  const std::shared_ptr<Number> &get_to() const noexcept { return to; }
22681 
22682  /**
22683  * \brief Getter for member variable \ref AssignedDefinition.start
22684  */
22685  const std::shared_ptr<Number> &get_start() const noexcept { return start; }
22686 
22687  /**
22688  * \brief Getter for member variable \ref AssignedDefinition.unit
22689  */
22690  const std::shared_ptr<Unit> &get_unit() const noexcept { return unit; }
22691 
22692  /**
22693  * \brief Getter for member variable \ref AssignedDefinition.abstol
22694  */
22695  const std::shared_ptr<Double> &get_abstol() const noexcept { return abstol; }
22696 
22697  /// \}
22698 
22699  /// \name Setters
22700  /// \{
22701 
22702  /**
22703  * \brief Set token for the current ast node
22704  */
22705  void set_token(const ModToken &tok) {
22706  token = std::make_shared<ModToken>(tok);
22707  }
22708 
22709  /**
22710  * \brief Setter for member variable \ref AssignedDefinition.name (rvalue
22711  * reference)
22712  */
22713  void set_name(std::shared_ptr<Identifier> &&name);
22714 
22715  /**
22716  * \brief Setter for member variable \ref AssignedDefinition.name
22717  */
22718  void set_name(const std::shared_ptr<Identifier> &name);
22719 
22720  /**
22721  * \brief Setter for member variable \ref AssignedDefinition.length (rvalue
22722  * reference)
22723  */
22724  void set_length(std::shared_ptr<Integer> &&length);
22725 
22726  /**
22727  * \brief Setter for member variable \ref AssignedDefinition.length
22728  */
22729  void set_length(const std::shared_ptr<Integer> &length);
22730 
22731  /**
22732  * \brief Setter for member variable \ref AssignedDefinition.from (rvalue
22733  * reference)
22734  */
22735  void set_from(std::shared_ptr<Number> &&from);
22736 
22737  /**
22738  * \brief Setter for member variable \ref AssignedDefinition.from
22739  */
22740  void set_from(const std::shared_ptr<Number> &from);
22741 
22742  /**
22743  * \brief Setter for member variable \ref AssignedDefinition.to (rvalue
22744  * reference)
22745  */
22746  void set_to(std::shared_ptr<Number> &&to);
22747 
22748  /**
22749  * \brief Setter for member variable \ref AssignedDefinition.to
22750  */
22751  void set_to(const std::shared_ptr<Number> &to);
22752 
22753  /**
22754  * \brief Setter for member variable \ref AssignedDefinition.start (rvalue
22755  * reference)
22756  */
22757  void set_start(std::shared_ptr<Number> &&start);
22758 
22759  /**
22760  * \brief Setter for member variable \ref AssignedDefinition.start
22761  */
22762  void set_start(const std::shared_ptr<Number> &start);
22763 
22764  /**
22765  * \brief Setter for member variable \ref AssignedDefinition.unit (rvalue
22766  * reference)
22767  */
22768  void set_unit(std::shared_ptr<Unit> &&unit);
22769 
22770  /**
22771  * \brief Setter for member variable \ref AssignedDefinition.unit
22772  */
22773  void set_unit(const std::shared_ptr<Unit> &unit);
22774 
22775  /**
22776  * \brief Setter for member variable \ref AssignedDefinition.abstol (rvalue
22777  * reference)
22778  */
22779  void set_abstol(std::shared_ptr<Double> &&abstol);
22780 
22781  /**
22782  * \brief Setter for member variable \ref AssignedDefinition.abstol
22783  */
22784  void set_abstol(const std::shared_ptr<Double> &abstol);
22785 
22786  /// \}
22787 
22788  /// \name Visitor
22789  /// \{
22790 
22791  /**
22792  * \brief visit children i.e. member variables of current node using provided
22793  * visitor
22794  *
22795  * Different nodes in the AST have different members (i.e. children). This
22796  * method recursively visits children using provided visitor.
22797  *
22798  * \param v Concrete visitor that will be used to recursively visit children
22799  *
22800  * \sa Ast::visit_children for example.
22801  */
22802  void visit_children(visitor::Visitor &v) override;
22803 
22804  /**
22805  * \brief visit children i.e. member variables of current node using provided
22806  * visitor
22807  *
22808  * Different nodes in the AST have different members (i.e. children). This
22809  * method recursively visits children using provided visitor.
22810  *
22811  * \param v Concrete constant visitor that will be used to recursively visit
22812  * children
22813  *
22814  * \sa Ast::visit_children for example.
22815  */
22816  void visit_children(visitor::ConstVisitor &v) const override;
22817 
22818  /**
22819  * \brief accept (or visit) the current AST node using provided visitor
22820  *
22821  * Instead of visiting children of AST node, like Ast::visit_children,
22822  * accept allows to visit the current node itself using provided concrete
22823  * visitor.
22824  *
22825  * \param v Concrete visitor that will be used to recursively visit node
22826  *
22827  * \sa Ast::accept for example.
22828  */
22829  void accept(visitor::Visitor &v) override;
22830 
22831  /**
22832  * \copydoc accept(visitor::Visitor&)
22833  */
22834  void accept(visitor::ConstVisitor &v) const override;
22835 
22836  /// \}
22837 
22838 private:
22839  /**
22840  * \brief Set this object as parent for all the children
22841  *
22842  * This should be called in every object (with children) constructor
22843  * to set parents. Since it is called only in the constructors it
22844  * should not be virtual to avoid ambiguities (issue #295).
22845  */
22846  void set_parent_in_children();
22847 };
22848 
22849 /** @} */ // end of ast_class
22850 
22851 } // namespace ast
22852 } // namespace nmodl
22853 #endif // !NMODL_AST_ASSIGNED_DEFINITION_HPP
22854 #ifndef NMODL_AST_PLOT_DECLARATION_HPP
22855 #define NMODL_AST_PLOT_DECLARATION_HPP
22856 
22857 namespace nmodl {
22858 namespace ast {
22859 
22860 /**
22861  * @addtogroup ast_class
22862  * @ingroup ast
22863  * @{
22864  */
22865 
22866 /**
22867  * \brief TODO
22868  *
22869  *
22870  */
22871 class PlotDeclaration : public Statement {
22872 private:
22873  /// TODO
22875  /// TODO
22876  std::shared_ptr<PlotVar> name;
22877  /// token with location information
22878  std::shared_ptr<ModToken> token;
22879 
22880 public:
22881  /// \name Ctor & dtor
22882  /// \{
22883 
22884  explicit PlotDeclaration(PlotVarVector variables, PlotVar *name);
22885  explicit PlotDeclaration(const PlotVarVector &variables,
22886  const std::shared_ptr<PlotVar> &name);
22887  PlotDeclaration(const PlotDeclaration &obj);
22888 
22889  virtual ~PlotDeclaration() = default;
22890 
22891  /// \}
22892 
22893  /**
22894  * \brief Check if the ast node is an instance of ast::PlotDeclaration
22895  * \return true as object is of type ast::PlotDeclaration
22896  */
22897  bool is_plot_declaration() const noexcept override { return true; }
22898 
22899  /**
22900  * \brief Return a copy of the current node
22901  *
22902  * Recursively make a new copy/clone of the current node including
22903  * all members and return a pointer to the node. This is used for
22904  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
22905  * ast.
22906  *
22907  * @return pointer to the clone/copy of the current node
22908  */
22909  PlotDeclaration *clone() const override { return new PlotDeclaration(*this); }
22910 
22911  /// \name Getters
22912  /// \{
22913 
22914  /**
22915  * \brief Return type (ast::AstNodeType) of ast node
22916  *
22917  * Every node in the ast has a type defined in ast::AstNodeType and this
22918  * function is used to retrieve the same.
22919  *
22920  * \return ast node type i.e. ast::AstNodeType::PLOT_DECLARATION
22921  *
22922  * \sa Ast::get_node_type_name
22923  */
22924  AstNodeType get_node_type() const noexcept override {
22926  }
22927 
22928  /**
22929  * \brief Return type (ast::AstNodeType) of ast node as std::string
22930  *
22931  * Every node in the ast has a type defined in ast::AstNodeType.
22932  * This type name can be returned as a std::string for printing
22933  * node to text/json form.
22934  *
22935  * \return name of the node type as a string i.e. "PlotDeclaration"
22936  *
22937  * \sa Ast::get_node_name
22938  */
22939  std::string get_node_type_name() const noexcept override {
22940  return "PlotDeclaration";
22941  }
22942 
22943  /**
22944  * \brief Return NMODL statement of ast node as std::string
22945  *
22946  * Every node is related to a special statement in the NMODL. This
22947  * statement can be returned as a std::string for printing to
22948  * text/json form.
22949  *
22950  * \return name of the statement as a string i.e. "PLOT "
22951  *
22952  * \sa Ast::get_nmodl_name
22953  */
22954  std::string get_nmodl_name() const noexcept override { return "PLOT "; }
22955 
22956  /**
22957  * \brief Get std::shared_ptr from `this` pointer of the current ast node
22958  */
22959  std::shared_ptr<Ast> get_shared_ptr() override {
22960  return std::static_pointer_cast<PlotDeclaration>(shared_from_this());
22961  }
22962 
22963  /**
22964  * \brief Get std::shared_ptr from `this` pointer of the current ast node
22965  */
22966  std::shared_ptr<const Ast> get_shared_ptr() const override {
22967  return std::static_pointer_cast<const PlotDeclaration>(shared_from_this());
22968  }
22969 
22970  /**
22971  * \brief Return associated token for the current ast node
22972  *
22973  * Not all ast nodes have token information. For example,
22974  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
22975  * solution of ODEs. In this case, we return nullptr to store in the
22976  * nmodl::symtab::SymbolTable.
22977  *
22978  * \return pointer to token if exist otherwise nullptr
22979  */
22980  const ModToken *get_token() const noexcept override { return token.get(); }
22981 
22982  /**
22983  * \brief Getter for member variable \ref PlotDeclaration.variables
22984  */
22985  const PlotVarVector &get_variables() const noexcept { return variables; }
22986 
22987  /**
22988  * \brief Getter for member variable \ref PlotDeclaration.name
22989  */
22990  const std::shared_ptr<PlotVar> &get_name() const noexcept { return name; }
22991 
22992  /// \}
22993 
22994  /// \name Setters
22995  /// \{
22996 
22997  /**
22998  * \brief Set token for the current ast node
22999  */
23000  void set_token(const ModToken &tok) {
23001  token = std::make_shared<ModToken>(tok);
23002  }
23003 
23004  /**
23005  * \brief Setter for member variable \ref PlotDeclaration.variables (rvalue
23006  * reference)
23007  */
23008  void set_variables(PlotVarVector &&variables);
23009 
23010  /**
23011  * \brief Setter for member variable \ref PlotDeclaration.variables
23012  */
23013  void set_variables(const PlotVarVector &variables);
23014 
23015  /**
23016  * \brief Setter for member variable \ref PlotDeclaration.name (rvalue
23017  * reference)
23018  */
23019  void set_name(std::shared_ptr<PlotVar> &&name);
23020 
23021  /**
23022  * \brief Setter for member variable \ref PlotDeclaration.name
23023  */
23024  void set_name(const std::shared_ptr<PlotVar> &name);
23025 
23026  /// \}
23027 
23028  /// \name Visitor
23029  /// \{
23030 
23031  /**
23032  * \brief visit children i.e. member variables of current node using provided
23033  * visitor
23034  *
23035  * Different nodes in the AST have different members (i.e. children). This
23036  * method recursively visits children using provided visitor.
23037  *
23038  * \param v Concrete visitor that will be used to recursively visit children
23039  *
23040  * \sa Ast::visit_children for example.
23041  */
23042  void visit_children(visitor::Visitor &v) override;
23043 
23044  /**
23045  * \brief visit children i.e. member variables of current node using provided
23046  * visitor
23047  *
23048  * Different nodes in the AST have different members (i.e. children). This
23049  * method recursively visits children using provided visitor.
23050  *
23051  * \param v Concrete constant visitor that will be used to recursively visit
23052  * children
23053  *
23054  * \sa Ast::visit_children for example.
23055  */
23056  void visit_children(visitor::ConstVisitor &v) const override;
23057 
23058  /**
23059  * \brief accept (or visit) the current AST node using provided visitor
23060  *
23061  * Instead of visiting children of AST node, like Ast::visit_children,
23062  * accept allows to visit the current node itself using provided concrete
23063  * visitor.
23064  *
23065  * \param v Concrete visitor that will be used to recursively visit node
23066  *
23067  * \sa Ast::accept for example.
23068  */
23069  void accept(visitor::Visitor &v) override;
23070 
23071  /**
23072  * \copydoc accept(visitor::Visitor&)
23073  */
23074  void accept(visitor::ConstVisitor &v) const override;
23075 
23076  /// \}
23077 
23078 private:
23079  /**
23080  * \brief Set this object as parent for all the children
23081  *
23082  * This should be called in every object (with children) constructor
23083  * to set parents. Since it is called only in the constructors it
23084  * should not be virtual to avoid ambiguities (issue #295).
23085  */
23086  void set_parent_in_children();
23087 };
23088 
23089 /** @} */ // end of ast_class
23090 
23091 } // namespace ast
23092 } // namespace nmodl
23093 #endif // !NMODL_AST_PLOT_DECLARATION_HPP
23094 #ifndef NMODL_AST_CONDUCTANCE_HINT_HPP
23095 #define NMODL_AST_CONDUCTANCE_HINT_HPP
23096 
23097 namespace nmodl {
23098 namespace ast {
23099 
23100 /**
23101  * @addtogroup ast_class
23102  * @ingroup ast
23103  * @{
23104  */
23105 
23106 /**
23107  * \brief Represents `CONDUCTANCE` statement in NMODL
23108  *
23109  * If `I/V` relation in the `BREAKPOINT` block is ohomic then one can
23110  * specify `CONDUCTANCE` hint for optimised code generation:
23111  *
23112  * \code{.mod}
23113  * CONDUCTANCE g USEION I
23114  * \endcode
23115  *
23116  * \sa nmodl::visitor::SympyConductanceVisitor
23117  *
23118  */
23119 class ConductanceHint : public Statement {
23120 private:
23121  /// Conductance variable
23122  std::shared_ptr<Name> conductance;
23123  /// Ion name
23124  std::shared_ptr<Name> ion;
23125  /// token with location information
23126  std::shared_ptr<ModToken> token;
23127 
23128 public:
23129  /// \name Ctor & dtor
23130  /// \{
23131 
23132  explicit ConductanceHint(Name *conductance, Name *ion);
23133  explicit ConductanceHint(const std::shared_ptr<Name> &conductance,
23134  const std::shared_ptr<Name> &ion);
23135  ConductanceHint(const ConductanceHint &obj);
23136 
23137  virtual ~ConductanceHint() = default;
23138 
23139  /// \}
23140 
23141  /**
23142  * \brief Check if the ast node is an instance of ast::ConductanceHint
23143  * \return true as object is of type ast::ConductanceHint
23144  */
23145  bool is_conductance_hint() const noexcept override { return true; }
23146 
23147  /**
23148  * \brief Return a copy of the current node
23149  *
23150  * Recursively make a new copy/clone of the current node including
23151  * all members and return a pointer to the node. This is used for
23152  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
23153  * ast.
23154  *
23155  * @return pointer to the clone/copy of the current node
23156  */
23157  ConductanceHint *clone() const override { return new ConductanceHint(*this); }
23158 
23159  /// \name Getters
23160  /// \{
23161 
23162  /**
23163  * \brief Return type (ast::AstNodeType) of ast node
23164  *
23165  * Every node in the ast has a type defined in ast::AstNodeType and this
23166  * function is used to retrieve the same.
23167  *
23168  * \return ast node type i.e. ast::AstNodeType::CONDUCTANCE_HINT
23169  *
23170  * \sa Ast::get_node_type_name
23171  */
23172  AstNodeType get_node_type() const noexcept override {
23174  }
23175 
23176  /**
23177  * \brief Return type (ast::AstNodeType) of ast node as std::string
23178  *
23179  * Every node in the ast has a type defined in ast::AstNodeType.
23180  * This type name can be returned as a std::string for printing
23181  * node to text/json form.
23182  *
23183  * \return name of the node type as a string i.e. "ConductanceHint"
23184  *
23185  * \sa Ast::get_node_name
23186  */
23187  std::string get_node_type_name() const noexcept override {
23188  return "ConductanceHint";
23189  }
23190 
23191  /**
23192  * \brief Return NMODL statement of ast node as std::string
23193  *
23194  * Every node is related to a special statement in the NMODL. This
23195  * statement can be returned as a std::string for printing to
23196  * text/json form.
23197  *
23198  * \return name of the statement as a string i.e. "CONDUCTANCE "
23199  *
23200  * \sa Ast::get_nmodl_name
23201  */
23202  std::string get_nmodl_name() const noexcept override {
23203  return "CONDUCTANCE ";
23204  }
23205 
23206  /**
23207  * \brief Get std::shared_ptr from `this` pointer of the current ast node
23208  */
23209  std::shared_ptr<Ast> get_shared_ptr() override {
23210  return std::static_pointer_cast<ConductanceHint>(shared_from_this());
23211  }
23212 
23213  /**
23214  * \brief Get std::shared_ptr from `this` pointer of the current ast node
23215  */
23216  std::shared_ptr<const Ast> get_shared_ptr() const override {
23217  return std::static_pointer_cast<const ConductanceHint>(shared_from_this());
23218  }
23219 
23220  /**
23221  * \brief Return associated token for the current ast node
23222  *
23223  * Not all ast nodes have token information. For example,
23224  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
23225  * solution of ODEs. In this case, we return nullptr to store in the
23226  * nmodl::symtab::SymbolTable.
23227  *
23228  * \return pointer to token if exist otherwise nullptr
23229  */
23230  const ModToken *get_token() const noexcept override { return token.get(); }
23231 
23232  /**
23233  * \brief Getter for member variable \ref ConductanceHint.conductance
23234  */
23235  const std::shared_ptr<Name> &get_conductance() const noexcept {
23236  return conductance;
23237  }
23238 
23239  /**
23240  * \brief Getter for member variable \ref ConductanceHint.ion
23241  */
23242  const std::shared_ptr<Name> &get_ion() const noexcept { return ion; }
23243 
23244  /// \}
23245 
23246  /// \name Setters
23247  /// \{
23248 
23249  /**
23250  * \brief Set token for the current ast node
23251  */
23252  void set_token(const ModToken &tok) {
23253  token = std::make_shared<ModToken>(tok);
23254  }
23255 
23256  /**
23257  * \brief Setter for member variable \ref ConductanceHint.conductance (rvalue
23258  * reference)
23259  */
23260  void set_conductance(std::shared_ptr<Name> &&conductance);
23261 
23262  /**
23263  * \brief Setter for member variable \ref ConductanceHint.conductance
23264  */
23265  void set_conductance(const std::shared_ptr<Name> &conductance);
23266 
23267  /**
23268  * \brief Setter for member variable \ref ConductanceHint.ion (rvalue
23269  * reference)
23270  */
23271  void set_ion(std::shared_ptr<Name> &&ion);
23272 
23273  /**
23274  * \brief Setter for member variable \ref ConductanceHint.ion
23275  */
23276  void set_ion(const std::shared_ptr<Name> &ion);
23277 
23278  /// \}
23279 
23280  /// \name Visitor
23281  /// \{
23282 
23283  /**
23284  * \brief visit children i.e. member variables of current node using provided
23285  * visitor
23286  *
23287  * Different nodes in the AST have different members (i.e. children). This
23288  * method recursively visits children using provided visitor.
23289  *
23290  * \param v Concrete visitor that will be used to recursively visit children
23291  *
23292  * \sa Ast::visit_children for example.
23293  */
23294  void visit_children(visitor::Visitor &v) override;
23295 
23296  /**
23297  * \brief visit children i.e. member variables of current node using provided
23298  * visitor
23299  *
23300  * Different nodes in the AST have different members (i.e. children). This
23301  * method recursively visits children using provided visitor.
23302  *
23303  * \param v Concrete constant visitor that will be used to recursively visit
23304  * children
23305  *
23306  * \sa Ast::visit_children for example.
23307  */
23308  void visit_children(visitor::ConstVisitor &v) const override;
23309 
23310  /**
23311  * \brief accept (or visit) the current AST node using provided visitor
23312  *
23313  * Instead of visiting children of AST node, like Ast::visit_children,
23314  * accept allows to visit the current node itself using provided concrete
23315  * visitor.
23316  *
23317  * \param v Concrete visitor that will be used to recursively visit node
23318  *
23319  * \sa Ast::accept for example.
23320  */
23321  void accept(visitor::Visitor &v) override;
23322 
23323  /**
23324  * \copydoc accept(visitor::Visitor&)
23325  */
23326  void accept(visitor::ConstVisitor &v) const override;
23327 
23328  /// \}
23329 
23330 private:
23331  /**
23332  * \brief Set this object as parent for all the children
23333  *
23334  * This should be called in every object (with children) constructor
23335  * to set parents. Since it is called only in the constructors it
23336  * should not be virtual to avoid ambiguities (issue #295).
23337  */
23338  void set_parent_in_children();
23339 };
23340 
23341 /** @} */ // end of ast_class
23342 
23343 } // namespace ast
23344 } // namespace nmodl
23345 #endif // !NMODL_AST_CONDUCTANCE_HINT_HPP
23346 #ifndef NMODL_AST_EXPRESSION_STATEMENT_HPP
23347 #define NMODL_AST_EXPRESSION_STATEMENT_HPP
23348 
23349 namespace nmodl {
23350 namespace ast {
23351 
23352 /**
23353  * @addtogroup ast_class
23354  * @ingroup ast
23355  * @{
23356  */
23357 
23358 /**
23359  * \brief TODO
23360  *
23361  *
23362  */
23364 private:
23365  /// TODO
23366  std::shared_ptr<Expression> expression;
23367  /// token with location information
23368  std::shared_ptr<ModToken> token;
23369 
23370 public:
23371  /// \name Ctor & dtor
23372  /// \{
23373 
23374  explicit ExpressionStatement(Expression *expression);
23375  explicit ExpressionStatement(const std::shared_ptr<Expression> &expression);
23377 
23378  virtual ~ExpressionStatement() = default;
23379 
23380  /// \}
23381 
23382  /**
23383  * \brief Check if the ast node is an instance of ast::ExpressionStatement
23384  * \return true as object is of type ast::ExpressionStatement
23385  */
23386  bool is_expression_statement() const noexcept override { return true; }
23387 
23388  /**
23389  * \brief Return a copy of the current node
23390  *
23391  * Recursively make a new copy/clone of the current node including
23392  * all members and return a pointer to the node. This is used for
23393  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
23394  * ast.
23395  *
23396  * @return pointer to the clone/copy of the current node
23397  */
23398  ExpressionStatement *clone() const override {
23399  return new ExpressionStatement(*this);
23400  }
23401 
23402  /// \name Getters
23403  /// \{
23404 
23405  /**
23406  * \brief Return type (ast::AstNodeType) of ast node
23407  *
23408  * Every node in the ast has a type defined in ast::AstNodeType and this
23409  * function is used to retrieve the same.
23410  *
23411  * \return ast node type i.e. ast::AstNodeType::EXPRESSION_STATEMENT
23412  *
23413  * \sa Ast::get_node_type_name
23414  */
23415  AstNodeType get_node_type() const noexcept override {
23417  }
23418 
23419  /**
23420  * \brief Return type (ast::AstNodeType) of ast node as std::string
23421  *
23422  * Every node in the ast has a type defined in ast::AstNodeType.
23423  * This type name can be returned as a std::string for printing
23424  * node to text/json form.
23425  *
23426  * \return name of the node type as a string i.e. "ExpressionStatement"
23427  *
23428  * \sa Ast::get_node_name
23429  */
23430  std::string get_node_type_name() const noexcept override {
23431  return "ExpressionStatement";
23432  }
23433 
23434  /**
23435  * \brief Get std::shared_ptr from `this` pointer of the current ast node
23436  */
23437  std::shared_ptr<Ast> get_shared_ptr() override {
23438  return std::static_pointer_cast<ExpressionStatement>(shared_from_this());
23439  }
23440 
23441  /**
23442  * \brief Get std::shared_ptr from `this` pointer of the current ast node
23443  */
23444  std::shared_ptr<const Ast> get_shared_ptr() const override {
23445  return std::static_pointer_cast<const ExpressionStatement>(
23446  shared_from_this());
23447  }
23448 
23449  /**
23450  * \brief Return associated token for the current ast node
23451  *
23452  * Not all ast nodes have token information. For example,
23453  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
23454  * solution of ODEs. In this case, we return nullptr to store in the
23455  * nmodl::symtab::SymbolTable.
23456  *
23457  * \return pointer to token if exist otherwise nullptr
23458  */
23459  const ModToken *get_token() const noexcept override { return token.get(); }
23460 
23461  /**
23462  * \brief Getter for member variable \ref ExpressionStatement.expression
23463  */
23464  const std::shared_ptr<Expression> &get_expression() const noexcept {
23465  return expression;
23466  }
23467 
23468  /// \}
23469 
23470  /// \name Setters
23471  /// \{
23472 
23473  /**
23474  * \brief Set token for the current ast node
23475  */
23476  void set_token(const ModToken &tok) {
23477  token = std::make_shared<ModToken>(tok);
23478  }
23479 
23480  /**
23481  * \brief Setter for member variable \ref ExpressionStatement.expression
23482  * (rvalue reference)
23483  */
23484  void set_expression(std::shared_ptr<Expression> &&expression);
23485 
23486  /**
23487  * \brief Setter for member variable \ref ExpressionStatement.expression
23488  */
23489  void set_expression(const std::shared_ptr<Expression> &expression);
23490 
23491  /// \}
23492 
23493  /// \name Visitor
23494  /// \{
23495 
23496  /**
23497  * \brief visit children i.e. member variables of current node using provided
23498  * visitor
23499  *
23500  * Different nodes in the AST have different members (i.e. children). This
23501  * method recursively visits children using provided visitor.
23502  *
23503  * \param v Concrete visitor that will be used to recursively visit children
23504  *
23505  * \sa Ast::visit_children for example.
23506  */
23507  void visit_children(visitor::Visitor &v) override;
23508 
23509  /**
23510  * \brief visit children i.e. member variables of current node using provided
23511  * visitor
23512  *
23513  * Different nodes in the AST have different members (i.e. children). This
23514  * method recursively visits children using provided visitor.
23515  *
23516  * \param v Concrete constant visitor that will be used to recursively visit
23517  * children
23518  *
23519  * \sa Ast::visit_children for example.
23520  */
23521  void visit_children(visitor::ConstVisitor &v) const override;
23522 
23523  /**
23524  * \brief accept (or visit) the current AST node using provided visitor
23525  *
23526  * Instead of visiting children of AST node, like Ast::visit_children,
23527  * accept allows to visit the current node itself using provided concrete
23528  * visitor.
23529  *
23530  * \param v Concrete visitor that will be used to recursively visit node
23531  *
23532  * \sa Ast::accept for example.
23533  */
23534  void accept(visitor::Visitor &v) override;
23535 
23536  /**
23537  * \copydoc accept(visitor::Visitor&)
23538  */
23539  void accept(visitor::ConstVisitor &v) const override;
23540 
23541  /// \}
23542 
23543 private:
23544  /**
23545  * \brief Set this object as parent for all the children
23546  *
23547  * This should be called in every object (with children) constructor
23548  * to set parents. Since it is called only in the constructors it
23549  * should not be virtual to avoid ambiguities (issue #295).
23550  */
23551  void set_parent_in_children();
23552 };
23553 
23554 /** @} */ // end of ast_class
23555 
23556 } // namespace ast
23557 } // namespace nmodl
23558 #endif // !NMODL_AST_EXPRESSION_STATEMENT_HPP
23559 #ifndef NMODL_AST_PROTECT_STATEMENT_HPP
23560 #define NMODL_AST_PROTECT_STATEMENT_HPP
23561 
23562 namespace nmodl {
23563 namespace ast {
23564 
23565 /**
23566  * @addtogroup ast_class
23567  * @ingroup ast
23568  * @{
23569  */
23570 
23571 /**
23572  * \brief TODO
23573  *
23574  *
23575  */
23576 class ProtectStatement : public Statement {
23577 private:
23578  /// TODO
23579  std::shared_ptr<Expression> expression;
23580  /// token with location information
23581  std::shared_ptr<ModToken> token;
23582 
23583 public:
23584  /// \name Ctor & dtor
23585  /// \{
23586 
23587  explicit ProtectStatement(Expression *expression);
23588  explicit ProtectStatement(const std::shared_ptr<Expression> &expression);
23589  ProtectStatement(const ProtectStatement &obj);
23590 
23591  virtual ~ProtectStatement() = default;
23592 
23593  /// \}
23594 
23595  /**
23596  * \brief Check if the ast node is an instance of ast::ProtectStatement
23597  * \return true as object is of type ast::ProtectStatement
23598  */
23599  bool is_protect_statement() const noexcept override { return true; }
23600 
23601  /**
23602  * \brief Return a copy of the current node
23603  *
23604  * Recursively make a new copy/clone of the current node including
23605  * all members and return a pointer to the node. This is used for
23606  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
23607  * ast.
23608  *
23609  * @return pointer to the clone/copy of the current node
23610  */
23611  ProtectStatement *clone() const override {
23612  return new ProtectStatement(*this);
23613  }
23614 
23615  /// \name Getters
23616  /// \{
23617 
23618  /**
23619  * \brief Return type (ast::AstNodeType) of ast node
23620  *
23621  * Every node in the ast has a type defined in ast::AstNodeType and this
23622  * function is used to retrieve the same.
23623  *
23624  * \return ast node type i.e. ast::AstNodeType::PROTECT_STATEMENT
23625  *
23626  * \sa Ast::get_node_type_name
23627  */
23628  AstNodeType get_node_type() const noexcept override {
23630  }
23631 
23632  /**
23633  * \brief Return type (ast::AstNodeType) of ast node as std::string
23634  *
23635  * Every node in the ast has a type defined in ast::AstNodeType.
23636  * This type name can be returned as a std::string for printing
23637  * node to text/json form.
23638  *
23639  * \return name of the node type as a string i.e. "ProtectStatement"
23640  *
23641  * \sa Ast::get_node_name
23642  */
23643  std::string get_node_type_name() const noexcept override {
23644  return "ProtectStatement";
23645  }
23646 
23647  /**
23648  * \brief Return NMODL statement of ast node as std::string
23649  *
23650  * Every node is related to a special statement in the NMODL. This
23651  * statement can be returned as a std::string for printing to
23652  * text/json form.
23653  *
23654  * \return name of the statement as a string i.e. "PROTECT "
23655  *
23656  * \sa Ast::get_nmodl_name
23657  */
23658  std::string get_nmodl_name() const noexcept override { return "PROTECT "; }
23659 
23660  /**
23661  * \brief Get std::shared_ptr from `this` pointer of the current ast node
23662  */
23663  std::shared_ptr<Ast> get_shared_ptr() override {
23664  return std::static_pointer_cast<ProtectStatement>(shared_from_this());
23665  }
23666 
23667  /**
23668  * \brief Get std::shared_ptr from `this` pointer of the current ast node
23669  */
23670  std::shared_ptr<const Ast> get_shared_ptr() const override {
23671  return std::static_pointer_cast<const ProtectStatement>(shared_from_this());
23672  }
23673 
23674  /**
23675  * \brief Return associated token for the current ast node
23676  *
23677  * Not all ast nodes have token information. For example,
23678  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
23679  * solution of ODEs. In this case, we return nullptr to store in the
23680  * nmodl::symtab::SymbolTable.
23681  *
23682  * \return pointer to token if exist otherwise nullptr
23683  */
23684  const ModToken *get_token() const noexcept override { return token.get(); }
23685 
23686  /**
23687  * \brief Getter for member variable \ref ProtectStatement.expression
23688  */
23689  const std::shared_ptr<Expression> &get_expression() const noexcept {
23690  return expression;
23691  }
23692 
23693  /// \}
23694 
23695  /// \name Setters
23696  /// \{
23697 
23698  /**
23699  * \brief Set token for the current ast node
23700  */
23701  void set_token(const ModToken &tok) {
23702  token = std::make_shared<ModToken>(tok);
23703  }
23704 
23705  /**
23706  * \brief Setter for member variable \ref ProtectStatement.expression (rvalue
23707  * reference)
23708  */
23709  void set_expression(std::shared_ptr<Expression> &&expression);
23710 
23711  /**
23712  * \brief Setter for member variable \ref ProtectStatement.expression
23713  */
23714  void set_expression(const std::shared_ptr<Expression> &expression);
23715 
23716  /// \}
23717 
23718  /// \name Visitor
23719  /// \{
23720 
23721  /**
23722  * \brief visit children i.e. member variables of current node using provided
23723  * visitor
23724  *
23725  * Different nodes in the AST have different members (i.e. children). This
23726  * method recursively visits children using provided visitor.
23727  *
23728  * \param v Concrete visitor that will be used to recursively visit children
23729  *
23730  * \sa Ast::visit_children for example.
23731  */
23732  void visit_children(visitor::Visitor &v) override;
23733 
23734  /**
23735  * \brief visit children i.e. member variables of current node using provided
23736  * visitor
23737  *
23738  * Different nodes in the AST have different members (i.e. children). This
23739  * method recursively visits children using provided visitor.
23740  *
23741  * \param v Concrete constant visitor that will be used to recursively visit
23742  * children
23743  *
23744  * \sa Ast::visit_children for example.
23745  */
23746  void visit_children(visitor::ConstVisitor &v) const override;
23747 
23748  /**
23749  * \brief accept (or visit) the current AST node using provided visitor
23750  *
23751  * Instead of visiting children of AST node, like Ast::visit_children,
23752  * accept allows to visit the current node itself using provided concrete
23753  * visitor.
23754  *
23755  * \param v Concrete visitor that will be used to recursively visit node
23756  *
23757  * \sa Ast::accept for example.
23758  */
23759  void accept(visitor::Visitor &v) override;
23760 
23761  /**
23762  * \copydoc accept(visitor::Visitor&)
23763  */
23764  void accept(visitor::ConstVisitor &v) const override;
23765 
23766  /// \}
23767 
23768 private:
23769  /**
23770  * \brief Set this object as parent for all the children
23771  *
23772  * This should be called in every object (with children) constructor
23773  * to set parents. Since it is called only in the constructors it
23774  * should not be virtual to avoid ambiguities (issue #295).
23775  */
23776  void set_parent_in_children();
23777 };
23778 
23779 /** @} */ // end of ast_class
23780 
23781 } // namespace ast
23782 } // namespace nmodl
23783 #endif // !NMODL_AST_PROTECT_STATEMENT_HPP
23784 #ifndef NMODL_AST_FROM_STATEMENT_HPP
23785 #define NMODL_AST_FROM_STATEMENT_HPP
23786 
23787 namespace nmodl {
23788 namespace ast {
23789 
23790 /**
23791  * @addtogroup ast_class
23792  * @ingroup ast
23793  * @{
23794  */
23795 
23796 /**
23797  * \brief TODO
23798  *
23799  *
23800  */
23801 class FromStatement : public Statement {
23802 private:
23803  /// TODO
23804  std::shared_ptr<Name> name;
23805  /// TODO
23806  std::shared_ptr<Expression> from;
23807  /// TODO
23808  std::shared_ptr<Expression> to;
23809  /// TODO
23810  std::shared_ptr<Expression> increment;
23811  /// TODO
23812  std::shared_ptr<StatementBlock> statement_block;
23813  /// token with location information
23814  std::shared_ptr<ModToken> token;
23815 
23816 public:
23817  /// \name Ctor & dtor
23818  /// \{
23819 
23820  explicit FromStatement(Name *name, Expression *from, Expression *to,
23821  Expression *increment,
23822  StatementBlock *statement_block);
23823  explicit FromStatement(
23824  const std::shared_ptr<Name> &name,
23825  const std::shared_ptr<Expression> &from,
23826  const std::shared_ptr<Expression> &to,
23827  const std::shared_ptr<Expression> &increment,
23828  const std::shared_ptr<StatementBlock> &statement_block);
23829  FromStatement(const FromStatement &obj);
23830 
23831  virtual ~FromStatement() = default;
23832 
23833  /// \}
23834 
23835  /**
23836  * \brief Check if the ast node is an instance of ast::FromStatement
23837  * \return true as object is of type ast::FromStatement
23838  */
23839  bool is_from_statement() const noexcept override { return true; }
23840 
23841  /**
23842  * \brief Return a copy of the current node
23843  *
23844  * Recursively make a new copy/clone of the current node including
23845  * all members and return a pointer to the node. This is used for
23846  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
23847  * ast.
23848  *
23849  * @return pointer to the clone/copy of the current node
23850  */
23851  FromStatement *clone() const override { return new FromStatement(*this); }
23852 
23853  /// \name Getters
23854  /// \{
23855 
23856  /**
23857  * \brief Return type (ast::AstNodeType) of ast node
23858  *
23859  * Every node in the ast has a type defined in ast::AstNodeType and this
23860  * function is used to retrieve the same.
23861  *
23862  * \return ast node type i.e. ast::AstNodeType::FROM_STATEMENT
23863  *
23864  * \sa Ast::get_node_type_name
23865  */
23866  AstNodeType get_node_type() const noexcept override {
23868  }
23869 
23870  /**
23871  * \brief Return type (ast::AstNodeType) of ast node as std::string
23872  *
23873  * Every node in the ast has a type defined in ast::AstNodeType.
23874  * This type name can be returned as a std::string for printing
23875  * node to text/json form.
23876  *
23877  * \return name of the node type as a string i.e. "FromStatement"
23878  *
23879  * \sa Ast::get_node_name
23880  */
23881  std::string get_node_type_name() const noexcept override {
23882  return "FromStatement";
23883  }
23884 
23885  /**
23886  * \brief Return NMODL statement of ast node as std::string
23887  *
23888  * Every node is related to a special statement in the NMODL. This
23889  * statement can be returned as a std::string for printing to
23890  * text/json form.
23891  *
23892  * \return name of the statement as a string i.e. "FROM "
23893  *
23894  * \sa Ast::get_nmodl_name
23895  */
23896  std::string get_nmodl_name() const noexcept override { return "FROM "; }
23897 
23898  /**
23899  * \brief Get std::shared_ptr from `this` pointer of the current ast node
23900  */
23901  std::shared_ptr<Ast> get_shared_ptr() override {
23902  return std::static_pointer_cast<FromStatement>(shared_from_this());
23903  }
23904 
23905  /**
23906  * \brief Get std::shared_ptr from `this` pointer of the current ast node
23907  */
23908  std::shared_ptr<const Ast> get_shared_ptr() const override {
23909  return std::static_pointer_cast<const FromStatement>(shared_from_this());
23910  }
23911 
23912  /**
23913  * \brief Return associated token for the current ast node
23914  *
23915  * Not all ast nodes have token information. For example,
23916  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
23917  * solution of ODEs. In this case, we return nullptr to store in the
23918  * nmodl::symtab::SymbolTable.
23919  *
23920  * \return pointer to token if exist otherwise nullptr
23921  */
23922  const ModToken *get_token() const noexcept override { return token.get(); }
23923 
23924  /**
23925  * \brief Return name of the node
23926  *
23927  * Some ast nodes have a member marked designated as node name. For example,
23928  * in case of this ast::Name has name designated as a
23929  * node name.
23930  *
23931  * @return name of the node as std::string
23932  *
23933  * \sa Ast::get_node_type_name
23934  */
23935  std::string get_node_name() const override;
23936 
23937  /**
23938  * \brief Getter for member variable \ref FromStatement.name
23939  */
23940  const std::shared_ptr<Name> &get_name() const noexcept { return name; }
23941 
23942  /**
23943  * \brief Getter for member variable \ref FromStatement.from
23944  */
23945  const std::shared_ptr<Expression> &get_from() const noexcept { return from; }
23946 
23947  /**
23948  * \brief Getter for member variable \ref FromStatement.to
23949  */
23950  const std::shared_ptr<Expression> &get_to() const noexcept { return to; }
23951 
23952  /**
23953  * \brief Getter for member variable \ref FromStatement.increment
23954  */
23955  const std::shared_ptr<Expression> &get_increment() const noexcept {
23956  return increment;
23957  }
23958 
23959  /**
23960  * \brief Getter for member variable \ref FromStatement.statement_block
23961  */
23962  const std::shared_ptr<StatementBlock> &get_statement_block() const
23963  noexcept override {
23964  return statement_block;
23965  }
23966 
23967  /// \}
23968 
23969  /// \name Setters
23970  /// \{
23971 
23972  /**
23973  * \brief Set token for the current ast node
23974  */
23975  void set_token(const ModToken &tok) {
23976  token = std::make_shared<ModToken>(tok);
23977  }
23978 
23979  /**
23980  * \brief Setter for member variable \ref FromStatement.name (rvalue
23981  * reference)
23982  */
23983  void set_name(std::shared_ptr<Name> &&name);
23984 
23985  /**
23986  * \brief Setter for member variable \ref FromStatement.name
23987  */
23988  void set_name(const std::shared_ptr<Name> &name);
23989 
23990  /**
23991  * \brief Setter for member variable \ref FromStatement.from (rvalue
23992  * reference)
23993  */
23994  void set_from(std::shared_ptr<Expression> &&from);
23995 
23996  /**
23997  * \brief Setter for member variable \ref FromStatement.from
23998  */
23999  void set_from(const std::shared_ptr<Expression> &from);
24000 
24001  /**
24002  * \brief Setter for member variable \ref FromStatement.to (rvalue reference)
24003  */
24004  void set_to(std::shared_ptr<Expression> &&to);
24005 
24006  /**
24007  * \brief Setter for member variable \ref FromStatement.to
24008  */
24009  void set_to(const std::shared_ptr<Expression> &to);
24010 
24011  /**
24012  * \brief Setter for member variable \ref FromStatement.increment (rvalue
24013  * reference)
24014  */
24015  void set_increment(std::shared_ptr<Expression> &&increment);
24016 
24017  /**
24018  * \brief Setter for member variable \ref FromStatement.increment
24019  */
24020  void set_increment(const std::shared_ptr<Expression> &increment);
24021 
24022  /**
24023  * \brief Setter for member variable \ref FromStatement.statement_block
24024  * (rvalue reference)
24025  */
24026  void set_statement_block(std::shared_ptr<StatementBlock> &&statement_block);
24027 
24028  /**
24029  * \brief Setter for member variable \ref FromStatement.statement_block
24030  */
24031  void
24032  set_statement_block(const std::shared_ptr<StatementBlock> &statement_block);
24033 
24034  /// \}
24035 
24036  /// \name Visitor
24037  /// \{
24038 
24039  /**
24040  * \brief visit children i.e. member variables of current node using provided
24041  * visitor
24042  *
24043  * Different nodes in the AST have different members (i.e. children). This
24044  * method recursively visits children using provided visitor.
24045  *
24046  * \param v Concrete visitor that will be used to recursively visit children
24047  *
24048  * \sa Ast::visit_children for example.
24049  */
24050  void visit_children(visitor::Visitor &v) override;
24051 
24052  /**
24053  * \brief visit children i.e. member variables of current node using provided
24054  * visitor
24055  *
24056  * Different nodes in the AST have different members (i.e. children). This
24057  * method recursively visits children using provided visitor.
24058  *
24059  * \param v Concrete constant visitor that will be used to recursively visit
24060  * children
24061  *
24062  * \sa Ast::visit_children for example.
24063  */
24064  void visit_children(visitor::ConstVisitor &v) const override;
24065 
24066  /**
24067  * \brief accept (or visit) the current AST node using provided visitor
24068  *
24069  * Instead of visiting children of AST node, like Ast::visit_children,
24070  * accept allows to visit the current node itself using provided concrete
24071  * visitor.
24072  *
24073  * \param v Concrete visitor that will be used to recursively visit node
24074  *
24075  * \sa Ast::accept for example.
24076  */
24077  void accept(visitor::Visitor &v) override;
24078 
24079  /**
24080  * \copydoc accept(visitor::Visitor&)
24081  */
24082  void accept(visitor::ConstVisitor &v) const override;
24083 
24084  /// \}
24085 
24086 private:
24087  /**
24088  * \brief Set this object as parent for all the children
24089  *
24090  * This should be called in every object (with children) constructor
24091  * to set parents. Since it is called only in the constructors it
24092  * should not be virtual to avoid ambiguities (issue #295).
24093  */
24094  void set_parent_in_children();
24095 };
24096 
24097 /** @} */ // end of ast_class
24098 
24099 } // namespace ast
24100 } // namespace nmodl
24101 #endif // !NMODL_AST_FROM_STATEMENT_HPP
24102 #ifndef NMODL_AST_FOR_ALL_STATEMENT_HPP
24103 #define NMODL_AST_FOR_ALL_STATEMENT_HPP
24104 
24105 namespace nmodl {
24106 namespace ast {
24107 
24108 /**
24109  * @addtogroup ast_class
24110  * @ingroup ast
24111  * @{
24112  */
24113 
24114 /**
24115  * \brief TODO
24116  *
24117  *
24118  */
24119 class ForAllStatement : public Statement {
24120 private:
24121  /// TODO
24122  std::shared_ptr<Name> name;
24123  /// TODO
24124  std::shared_ptr<StatementBlock> statement_block;
24125  /// token with location information
24126  std::shared_ptr<ModToken> token;
24127 
24128 public:
24129  /// \name Ctor & dtor
24130  /// \{
24131 
24132  explicit ForAllStatement(Name *name, StatementBlock *statement_block);
24133  explicit ForAllStatement(
24134  const std::shared_ptr<Name> &name,
24135  const std::shared_ptr<StatementBlock> &statement_block);
24136  ForAllStatement(const ForAllStatement &obj);
24137 
24138  virtual ~ForAllStatement() = default;
24139 
24140  /// \}
24141 
24142  /**
24143  * \brief Check if the ast node is an instance of ast::ForAllStatement
24144  * \return true as object is of type ast::ForAllStatement
24145  */
24146  bool is_for_all_statement() const noexcept override { return true; }
24147 
24148  /**
24149  * \brief Return a copy of the current node
24150  *
24151  * Recursively make a new copy/clone of the current node including
24152  * all members and return a pointer to the node. This is used for
24153  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
24154  * ast.
24155  *
24156  * @return pointer to the clone/copy of the current node
24157  */
24158  ForAllStatement *clone() const override { return new ForAllStatement(*this); }
24159 
24160  /// \name Getters
24161  /// \{
24162 
24163  /**
24164  * \brief Return type (ast::AstNodeType) of ast node
24165  *
24166  * Every node in the ast has a type defined in ast::AstNodeType and this
24167  * function is used to retrieve the same.
24168  *
24169  * \return ast node type i.e. ast::AstNodeType::FOR_ALL_STATEMENT
24170  *
24171  * \sa Ast::get_node_type_name
24172  */
24173  AstNodeType get_node_type() const noexcept override {
24175  }
24176 
24177  /**
24178  * \brief Return type (ast::AstNodeType) of ast node as std::string
24179  *
24180  * Every node in the ast has a type defined in ast::AstNodeType.
24181  * This type name can be returned as a std::string for printing
24182  * node to text/json form.
24183  *
24184  * \return name of the node type as a string i.e. "ForAllStatement"
24185  *
24186  * \sa Ast::get_node_name
24187  */
24188  std::string get_node_type_name() const noexcept override {
24189  return "ForAllStatement";
24190  }
24191 
24192  /**
24193  * \brief Return NMODL statement of ast node as std::string
24194  *
24195  * Every node is related to a special statement in the NMODL. This
24196  * statement can be returned as a std::string for printing to
24197  * text/json form.
24198  *
24199  * \return name of the statement as a string i.e. "FORALL "
24200  *
24201  * \sa Ast::get_nmodl_name
24202  */
24203  std::string get_nmodl_name() const noexcept override { return "FORALL "; }
24204 
24205  /**
24206  * \brief Get std::shared_ptr from `this` pointer of the current ast node
24207  */
24208  std::shared_ptr<Ast> get_shared_ptr() override {
24209  return std::static_pointer_cast<ForAllStatement>(shared_from_this());
24210  }
24211 
24212  /**
24213  * \brief Get std::shared_ptr from `this` pointer of the current ast node
24214  */
24215  std::shared_ptr<const Ast> get_shared_ptr() const override {
24216  return std::static_pointer_cast<const ForAllStatement>(shared_from_this());
24217  }
24218 
24219  /**
24220  * \brief Return associated token for the current ast node
24221  *
24222  * Not all ast nodes have token information. For example,
24223  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
24224  * solution of ODEs. In this case, we return nullptr to store in the
24225  * nmodl::symtab::SymbolTable.
24226  *
24227  * \return pointer to token if exist otherwise nullptr
24228  */
24229  const ModToken *get_token() const noexcept override { return token.get(); }
24230 
24231  /**
24232  * \brief Getter for member variable \ref ForAllStatement.name
24233  */
24234  const std::shared_ptr<Name> &get_name() const noexcept { return name; }
24235 
24236  /**
24237  * \brief Getter for member variable \ref ForAllStatement.statement_block
24238  */
24239  const std::shared_ptr<StatementBlock> &get_statement_block() const
24240  noexcept override {
24241  return statement_block;
24242  }
24243 
24244  /// \}
24245 
24246  /// \name Setters
24247  /// \{
24248 
24249  /**
24250  * \brief Set token for the current ast node
24251  */
24252  void set_token(const ModToken &tok) {
24253  token = std::make_shared<ModToken>(tok);
24254  }
24255 
24256  /**
24257  * \brief Setter for member variable \ref ForAllStatement.name (rvalue
24258  * reference)
24259  */
24260  void set_name(std::shared_ptr<Name> &&name);
24261 
24262  /**
24263  * \brief Setter for member variable \ref ForAllStatement.name
24264  */
24265  void set_name(const std::shared_ptr<Name> &name);
24266 
24267  /**
24268  * \brief Setter for member variable \ref ForAllStatement.statement_block
24269  * (rvalue reference)
24270  */
24271  void set_statement_block(std::shared_ptr<StatementBlock> &&statement_block);
24272 
24273  /**
24274  * \brief Setter for member variable \ref ForAllStatement.statement_block
24275  */
24276  void
24277  set_statement_block(const std::shared_ptr<StatementBlock> &statement_block);
24278 
24279  /// \}
24280 
24281  /// \name Visitor
24282  /// \{
24283 
24284  /**
24285  * \brief visit children i.e. member variables of current node using provided
24286  * visitor
24287  *
24288  * Different nodes in the AST have different members (i.e. children). This
24289  * method recursively visits children using provided visitor.
24290  *
24291  * \param v Concrete visitor that will be used to recursively visit children
24292  *
24293  * \sa Ast::visit_children for example.
24294  */
24295  void visit_children(visitor::Visitor &v) override;
24296 
24297  /**
24298  * \brief visit children i.e. member variables of current node using provided
24299  * visitor
24300  *
24301  * Different nodes in the AST have different members (i.e. children). This
24302  * method recursively visits children using provided visitor.
24303  *
24304  * \param v Concrete constant visitor that will be used to recursively visit
24305  * children
24306  *
24307  * \sa Ast::visit_children for example.
24308  */
24309  void visit_children(visitor::ConstVisitor &v) const override;
24310 
24311  /**
24312  * \brief accept (or visit) the current AST node using provided visitor
24313  *
24314  * Instead of visiting children of AST node, like Ast::visit_children,
24315  * accept allows to visit the current node itself using provided concrete
24316  * visitor.
24317  *
24318  * \param v Concrete visitor that will be used to recursively visit node
24319  *
24320  * \sa Ast::accept for example.
24321  */
24322  void accept(visitor::Visitor &v) override;
24323 
24324  /**
24325  * \copydoc accept(visitor::Visitor&)
24326  */
24327  void accept(visitor::ConstVisitor &v) const override;
24328 
24329  /// \}
24330 
24331 private:
24332  /**
24333  * \brief Set this object as parent for all the children
24334  *
24335  * This should be called in every object (with children) constructor
24336  * to set parents. Since it is called only in the constructors it
24337  * should not be virtual to avoid ambiguities (issue #295).
24338  */
24339  void set_parent_in_children();
24340 };
24341 
24342 /** @} */ // end of ast_class
24343 
24344 } // namespace ast
24345 } // namespace nmodl
24346 #endif // !NMODL_AST_FOR_ALL_STATEMENT_HPP
24347 #ifndef NMODL_AST_WHILE_STATEMENT_HPP
24348 #define NMODL_AST_WHILE_STATEMENT_HPP
24349 
24350 namespace nmodl {
24351 namespace ast {
24352 
24353 /**
24354  * @addtogroup ast_class
24355  * @ingroup ast
24356  * @{
24357  */
24358 
24359 /**
24360  * \brief TODO
24361  *
24362  *
24363  */
24364 class WhileStatement : public Statement {
24365 private:
24366  /// TODO
24367  std::shared_ptr<Expression> condition;
24368  /// TODO
24369  std::shared_ptr<StatementBlock> statement_block;
24370  /// token with location information
24371  std::shared_ptr<ModToken> token;
24372 
24373 public:
24374  /// \name Ctor & dtor
24375  /// \{
24376 
24377  explicit WhileStatement(Expression *condition,
24378  StatementBlock *statement_block);
24379  explicit WhileStatement(
24380  const std::shared_ptr<Expression> &condition,
24381  const std::shared_ptr<StatementBlock> &statement_block);
24382  WhileStatement(const WhileStatement &obj);
24383 
24384  virtual ~WhileStatement() = default;
24385 
24386  /// \}
24387 
24388  /**
24389  * \brief Check if the ast node is an instance of ast::WhileStatement
24390  * \return true as object is of type ast::WhileStatement
24391  */
24392  bool is_while_statement() const noexcept override { return true; }
24393 
24394  /**
24395  * \brief Return a copy of the current node
24396  *
24397  * Recursively make a new copy/clone of the current node including
24398  * all members and return a pointer to the node. This is used for
24399  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
24400  * ast.
24401  *
24402  * @return pointer to the clone/copy of the current node
24403  */
24404  WhileStatement *clone() const override { return new WhileStatement(*this); }
24405 
24406  /// \name Getters
24407  /// \{
24408 
24409  /**
24410  * \brief Return type (ast::AstNodeType) of ast node
24411  *
24412  * Every node in the ast has a type defined in ast::AstNodeType and this
24413  * function is used to retrieve the same.
24414  *
24415  * \return ast node type i.e. ast::AstNodeType::WHILE_STATEMENT
24416  *
24417  * \sa Ast::get_node_type_name
24418  */
24419  AstNodeType get_node_type() const noexcept override {
24421  }
24422 
24423  /**
24424  * \brief Return type (ast::AstNodeType) of ast node as std::string
24425  *
24426  * Every node in the ast has a type defined in ast::AstNodeType.
24427  * This type name can be returned as a std::string for printing
24428  * node to text/json form.
24429  *
24430  * \return name of the node type as a string i.e. "WhileStatement"
24431  *
24432  * \sa Ast::get_node_name
24433  */
24434  std::string get_node_type_name() const noexcept override {
24435  return "WhileStatement";
24436  }
24437 
24438  /**
24439  * \brief Return NMODL statement of ast node as std::string
24440  *
24441  * Every node is related to a special statement in the NMODL. This
24442  * statement can be returned as a std::string for printing to
24443  * text/json form.
24444  *
24445  * \return name of the statement as a string i.e. "WHILE "
24446  *
24447  * \sa Ast::get_nmodl_name
24448  */
24449  std::string get_nmodl_name() const noexcept override { return "WHILE "; }
24450 
24451  /**
24452  * \brief Get std::shared_ptr from `this` pointer of the current ast node
24453  */
24454  std::shared_ptr<Ast> get_shared_ptr() override {
24455  return std::static_pointer_cast<WhileStatement>(shared_from_this());
24456  }
24457 
24458  /**
24459  * \brief Get std::shared_ptr from `this` pointer of the current ast node
24460  */
24461  std::shared_ptr<const Ast> get_shared_ptr() const override {
24462  return std::static_pointer_cast<const WhileStatement>(shared_from_this());
24463  }
24464 
24465  /**
24466  * \brief Return associated token for the current ast node
24467  *
24468  * Not all ast nodes have token information. For example,
24469  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
24470  * solution of ODEs. In this case, we return nullptr to store in the
24471  * nmodl::symtab::SymbolTable.
24472  *
24473  * \return pointer to token if exist otherwise nullptr
24474  */
24475  const ModToken *get_token() const noexcept override { return token.get(); }
24476 
24477  /**
24478  * \brief Getter for member variable \ref WhileStatement.condition
24479  */
24480  const std::shared_ptr<Expression> &get_condition() const noexcept {
24481  return condition;
24482  }
24483 
24484  /**
24485  * \brief Getter for member variable \ref WhileStatement.statement_block
24486  */
24487  const std::shared_ptr<StatementBlock> &get_statement_block() const
24488  noexcept override {
24489  return statement_block;
24490  }
24491 
24492  /// \}
24493 
24494  /// \name Setters
24495  /// \{
24496 
24497  /**
24498  * \brief Set token for the current ast node
24499  */
24500  void set_token(const ModToken &tok) {
24501  token = std::make_shared<ModToken>(tok);
24502  }
24503 
24504  /**
24505  * \brief Setter for member variable \ref WhileStatement.condition (rvalue
24506  * reference)
24507  */
24508  void set_condition(std::shared_ptr<Expression> &&condition);
24509 
24510  /**
24511  * \brief Setter for member variable \ref WhileStatement.condition
24512  */
24513  void set_condition(const std::shared_ptr<Expression> &condition);
24514 
24515  /**
24516  * \brief Setter for member variable \ref WhileStatement.statement_block
24517  * (rvalue reference)
24518  */
24519  void set_statement_block(std::shared_ptr<StatementBlock> &&statement_block);
24520 
24521  /**
24522  * \brief Setter for member variable \ref WhileStatement.statement_block
24523  */
24524  void
24525  set_statement_block(const std::shared_ptr<StatementBlock> &statement_block);
24526 
24527  /// \}
24528 
24529  /// \name Visitor
24530  /// \{
24531 
24532  /**
24533  * \brief visit children i.e. member variables of current node using provided
24534  * visitor
24535  *
24536  * Different nodes in the AST have different members (i.e. children). This
24537  * method recursively visits children using provided visitor.
24538  *
24539  * \param v Concrete visitor that will be used to recursively visit children
24540  *
24541  * \sa Ast::visit_children for example.
24542  */
24543  void visit_children(visitor::Visitor &v) override;
24544 
24545  /**
24546  * \brief visit children i.e. member variables of current node using provided
24547  * visitor
24548  *
24549  * Different nodes in the AST have different members (i.e. children). This
24550  * method recursively visits children using provided visitor.
24551  *
24552  * \param v Concrete constant visitor that will be used to recursively visit
24553  * children
24554  *
24555  * \sa Ast::visit_children for example.
24556  */
24557  void visit_children(visitor::ConstVisitor &v) const override;
24558 
24559  /**
24560  * \brief accept (or visit) the current AST node using provided visitor
24561  *
24562  * Instead of visiting children of AST node, like Ast::visit_children,
24563  * accept allows to visit the current node itself using provided concrete
24564  * visitor.
24565  *
24566  * \param v Concrete visitor that will be used to recursively visit node
24567  *
24568  * \sa Ast::accept for example.
24569  */
24570  void accept(visitor::Visitor &v) override;
24571 
24572  /**
24573  * \copydoc accept(visitor::Visitor&)
24574  */
24575  void accept(visitor::ConstVisitor &v) const override;
24576 
24577  /// \}
24578 
24579 private:
24580  /**
24581  * \brief Set this object as parent for all the children
24582  *
24583  * This should be called in every object (with children) constructor
24584  * to set parents. Since it is called only in the constructors it
24585  * should not be virtual to avoid ambiguities (issue #295).
24586  */
24587  void set_parent_in_children();
24588 };
24589 
24590 /** @} */ // end of ast_class
24591 
24592 } // namespace ast
24593 } // namespace nmodl
24594 #endif // !NMODL_AST_WHILE_STATEMENT_HPP
24595 #ifndef NMODL_AST_IF_STATEMENT_HPP
24596 #define NMODL_AST_IF_STATEMENT_HPP
24597 
24598 namespace nmodl {
24599 namespace ast {
24600 
24601 /**
24602  * @addtogroup ast_class
24603  * @ingroup ast
24604  * @{
24605  */
24606 
24607 /**
24608  * \brief TODO
24609  *
24610  *
24611  */
24612 class IfStatement : public Statement {
24613 private:
24614  /// TODO
24615  std::shared_ptr<Expression> condition;
24616  /// TODO
24617  std::shared_ptr<StatementBlock> statement_block;
24618  /// TODO
24620  /// TODO
24621  std::shared_ptr<ElseStatement> elses;
24622  /// token with location information
24623  std::shared_ptr<ModToken> token;
24624 
24625 public:
24626  /// \name Ctor & dtor
24627  /// \{
24628 
24629  explicit IfStatement(Expression *condition, StatementBlock *statement_block,
24630  ElseIfStatementVector elseifs, ElseStatement *elses);
24631  explicit IfStatement(const std::shared_ptr<Expression> &condition,
24632  const std::shared_ptr<StatementBlock> &statement_block,
24633  const ElseIfStatementVector &elseifs,
24634  const std::shared_ptr<ElseStatement> &elses);
24635  IfStatement(const IfStatement &obj);
24636 
24637  virtual ~IfStatement() = default;
24638 
24639  /// \}
24640 
24641  /**
24642  * \brief Check if the ast node is an instance of ast::IfStatement
24643  * \return true as object is of type ast::IfStatement
24644  */
24645  bool is_if_statement() const noexcept override { return true; }
24646 
24647  /**
24648  * \brief Return a copy of the current node
24649  *
24650  * Recursively make a new copy/clone of the current node including
24651  * all members and return a pointer to the node. This is used for
24652  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
24653  * ast.
24654  *
24655  * @return pointer to the clone/copy of the current node
24656  */
24657  IfStatement *clone() const override { return new IfStatement(*this); }
24658 
24659  /// \name Getters
24660  /// \{
24661 
24662  /**
24663  * \brief Return type (ast::AstNodeType) of ast node
24664  *
24665  * Every node in the ast has a type defined in ast::AstNodeType and this
24666  * function is used to retrieve the same.
24667  *
24668  * \return ast node type i.e. ast::AstNodeType::IF_STATEMENT
24669  *
24670  * \sa Ast::get_node_type_name
24671  */
24672  AstNodeType get_node_type() const noexcept override {
24674  }
24675 
24676  /**
24677  * \brief Return type (ast::AstNodeType) of ast node as std::string
24678  *
24679  * Every node in the ast has a type defined in ast::AstNodeType.
24680  * This type name can be returned as a std::string for printing
24681  * node to text/json form.
24682  *
24683  * \return name of the node type as a string i.e. "IfStatement"
24684  *
24685  * \sa Ast::get_node_name
24686  */
24687  std::string get_node_type_name() const noexcept override {
24688  return "IfStatement";
24689  }
24690 
24691  /**
24692  * \brief Return NMODL statement of ast node as std::string
24693  *
24694  * Every node is related to a special statement in the NMODL. This
24695  * statement can be returned as a std::string for printing to
24696  * text/json form.
24697  *
24698  * \return name of the statement as a string i.e. "IF "
24699  *
24700  * \sa Ast::get_nmodl_name
24701  */
24702  std::string get_nmodl_name() const noexcept override { return "IF "; }
24703 
24704  /**
24705  * \brief Get std::shared_ptr from `this` pointer of the current ast node
24706  */
24707  std::shared_ptr<Ast> get_shared_ptr() override {
24708  return std::static_pointer_cast<IfStatement>(shared_from_this());
24709  }
24710 
24711  /**
24712  * \brief Get std::shared_ptr from `this` pointer of the current ast node
24713  */
24714  std::shared_ptr<const Ast> get_shared_ptr() const override {
24715  return std::static_pointer_cast<const IfStatement>(shared_from_this());
24716  }
24717 
24718  /**
24719  * \brief Return associated token for the current ast node
24720  *
24721  * Not all ast nodes have token information. For example,
24722  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
24723  * solution of ODEs. In this case, we return nullptr to store in the
24724  * nmodl::symtab::SymbolTable.
24725  *
24726  * \return pointer to token if exist otherwise nullptr
24727  */
24728  const ModToken *get_token() const noexcept override { return token.get(); }
24729 
24730  /**
24731  * \brief Getter for member variable \ref IfStatement.condition
24732  */
24733  const std::shared_ptr<Expression> &get_condition() const noexcept {
24734  return condition;
24735  }
24736 
24737  /**
24738  * \brief Getter for member variable \ref IfStatement.statement_block
24739  */
24740  const std::shared_ptr<StatementBlock> &get_statement_block() const
24741  noexcept override {
24742  return statement_block;
24743  }
24744 
24745  /**
24746  * \brief Getter for member variable \ref IfStatement.elseifs
24747  */
24748  const ElseIfStatementVector &get_elseifs() const noexcept { return elseifs; }
24749 
24750  /**
24751  * \brief Getter for member variable \ref IfStatement.elses
24752  */
24753  const std::shared_ptr<ElseStatement> &get_elses() const noexcept {
24754  return elses;
24755  }
24756 
24757  /// \}
24758 
24759  /// \name Setters
24760  /// \{
24761 
24762  /**
24763  * \brief Set token for the current ast node
24764  */
24765  void set_token(const ModToken &tok) {
24766  token = std::make_shared<ModToken>(tok);
24767  }
24768 
24769  /**
24770  * \brief Setter for member variable \ref IfStatement.condition (rvalue
24771  * reference)
24772  */
24773  void set_condition(std::shared_ptr<Expression> &&condition);
24774 
24775  /**
24776  * \brief Setter for member variable \ref IfStatement.condition
24777  */
24778  void set_condition(const std::shared_ptr<Expression> &condition);
24779 
24780  /**
24781  * \brief Setter for member variable \ref IfStatement.statement_block (rvalue
24782  * reference)
24783  */
24784  void set_statement_block(std::shared_ptr<StatementBlock> &&statement_block);
24785 
24786  /**
24787  * \brief Setter for member variable \ref IfStatement.statement_block
24788  */
24789  void
24790  set_statement_block(const std::shared_ptr<StatementBlock> &statement_block);
24791 
24792  /**
24793  * \brief Setter for member variable \ref IfStatement.elseifs (rvalue
24794  * reference)
24795  */
24796  void set_elseifs(ElseIfStatementVector &&elseifs);
24797 
24798  /**
24799  * \brief Setter for member variable \ref IfStatement.elseifs
24800  */
24801  void set_elseifs(const ElseIfStatementVector &elseifs);
24802 
24803  /**
24804  * \brief Setter for member variable \ref IfStatement.elses (rvalue reference)
24805  */
24806  void set_elses(std::shared_ptr<ElseStatement> &&elses);
24807 
24808  /**
24809  * \brief Setter for member variable \ref IfStatement.elses
24810  */
24811  void set_elses(const std::shared_ptr<ElseStatement> &elses);
24812 
24813  /// \}
24814 
24815  /// \name Visitor
24816  /// \{
24817 
24818  /**
24819  * \brief visit children i.e. member variables of current node using provided
24820  * visitor
24821  *
24822  * Different nodes in the AST have different members (i.e. children). This
24823  * method recursively visits children using provided visitor.
24824  *
24825  * \param v Concrete visitor that will be used to recursively visit children
24826  *
24827  * \sa Ast::visit_children for example.
24828  */
24829  void visit_children(visitor::Visitor &v) override;
24830 
24831  /**
24832  * \brief visit children i.e. member variables of current node using provided
24833  * visitor
24834  *
24835  * Different nodes in the AST have different members (i.e. children). This
24836  * method recursively visits children using provided visitor.
24837  *
24838  * \param v Concrete constant visitor that will be used to recursively visit
24839  * children
24840  *
24841  * \sa Ast::visit_children for example.
24842  */
24843  void visit_children(visitor::ConstVisitor &v) const override;
24844 
24845  /**
24846  * \brief accept (or visit) the current AST node using provided visitor
24847  *
24848  * Instead of visiting children of AST node, like Ast::visit_children,
24849  * accept allows to visit the current node itself using provided concrete
24850  * visitor.
24851  *
24852  * \param v Concrete visitor that will be used to recursively visit node
24853  *
24854  * \sa Ast::accept for example.
24855  */
24856  void accept(visitor::Visitor &v) override;
24857 
24858  /**
24859  * \copydoc accept(visitor::Visitor&)
24860  */
24861  void accept(visitor::ConstVisitor &v) const override;
24862 
24863  /// \}
24864 
24865 private:
24866  /**
24867  * \brief Set this object as parent for all the children
24868  *
24869  * This should be called in every object (with children) constructor
24870  * to set parents. Since it is called only in the constructors it
24871  * should not be virtual to avoid ambiguities (issue #295).
24872  */
24873  void set_parent_in_children();
24874 };
24875 
24876 /** @} */ // end of ast_class
24877 
24878 } // namespace ast
24879 } // namespace nmodl
24880 #endif // !NMODL_AST_IF_STATEMENT_HPP
24881 #ifndef NMODL_AST_ELSE_IF_STATEMENT_HPP
24882 #define NMODL_AST_ELSE_IF_STATEMENT_HPP
24883 
24884 namespace nmodl {
24885 namespace ast {
24886 
24887 /**
24888  * @addtogroup ast_class
24889  * @ingroup ast
24890  * @{
24891  */
24892 
24893 /**
24894  * \brief TODO
24895  *
24896  *
24897  */
24898 class ElseIfStatement : public Statement {
24899 private:
24900  /// TODO
24901  std::shared_ptr<Expression> condition;
24902  /// TODO
24903  std::shared_ptr<StatementBlock> statement_block;
24904  /// token with location information
24905  std::shared_ptr<ModToken> token;
24906 
24907 public:
24908  /// \name Ctor & dtor
24909  /// \{
24910 
24911  explicit ElseIfStatement(Expression *condition,
24912  StatementBlock *statement_block);
24913  explicit ElseIfStatement(
24914  const std::shared_ptr<Expression> &condition,
24915  const std::shared_ptr<StatementBlock> &statement_block);
24916  ElseIfStatement(const ElseIfStatement &obj);
24917 
24918  virtual ~ElseIfStatement() = default;
24919 
24920  /// \}
24921 
24922  /**
24923  * \brief Check if the ast node is an instance of ast::ElseIfStatement
24924  * \return true as object is of type ast::ElseIfStatement
24925  */
24926  bool is_else_if_statement() const noexcept override { return true; }
24927 
24928  /**
24929  * \brief Return a copy of the current node
24930  *
24931  * Recursively make a new copy/clone of the current node including
24932  * all members and return a pointer to the node. This is used for
24933  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
24934  * ast.
24935  *
24936  * @return pointer to the clone/copy of the current node
24937  */
24938  ElseIfStatement *clone() const override { return new ElseIfStatement(*this); }
24939 
24940  /// \name Getters
24941  /// \{
24942 
24943  /**
24944  * \brief Return type (ast::AstNodeType) of ast node
24945  *
24946  * Every node in the ast has a type defined in ast::AstNodeType and this
24947  * function is used to retrieve the same.
24948  *
24949  * \return ast node type i.e. ast::AstNodeType::ELSE_IF_STATEMENT
24950  *
24951  * \sa Ast::get_node_type_name
24952  */
24953  AstNodeType get_node_type() const noexcept override {
24955  }
24956 
24957  /**
24958  * \brief Return type (ast::AstNodeType) of ast node as std::string
24959  *
24960  * Every node in the ast has a type defined in ast::AstNodeType.
24961  * This type name can be returned as a std::string for printing
24962  * node to text/json form.
24963  *
24964  * \return name of the node type as a string i.e. "ElseIfStatement"
24965  *
24966  * \sa Ast::get_node_name
24967  */
24968  std::string get_node_type_name() const noexcept override {
24969  return "ElseIfStatement";
24970  }
24971 
24972  /**
24973  * \brief Return NMODL statement of ast node as std::string
24974  *
24975  * Every node is related to a special statement in the NMODL. This
24976  * statement can be returned as a std::string for printing to
24977  * text/json form.
24978  *
24979  * \return name of the statement as a string i.e. " ELSE IF "
24980  *
24981  * \sa Ast::get_nmodl_name
24982  */
24983  std::string get_nmodl_name() const noexcept override { return " ELSE IF "; }
24984 
24985  /**
24986  * \brief Get std::shared_ptr from `this` pointer of the current ast node
24987  */
24988  std::shared_ptr<Ast> get_shared_ptr() override {
24989  return std::static_pointer_cast<ElseIfStatement>(shared_from_this());
24990  }
24991 
24992  /**
24993  * \brief Get std::shared_ptr from `this` pointer of the current ast node
24994  */
24995  std::shared_ptr<const Ast> get_shared_ptr() const override {
24996  return std::static_pointer_cast<const ElseIfStatement>(shared_from_this());
24997  }
24998 
24999  /**
25000  * \brief Return associated token for the current ast node
25001  *
25002  * Not all ast nodes have token information. For example,
25003  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
25004  * solution of ODEs. In this case, we return nullptr to store in the
25005  * nmodl::symtab::SymbolTable.
25006  *
25007  * \return pointer to token if exist otherwise nullptr
25008  */
25009  const ModToken *get_token() const noexcept override { return token.get(); }
25010 
25011  /**
25012  * \brief Getter for member variable \ref ElseIfStatement.condition
25013  */
25014  const std::shared_ptr<Expression> &get_condition() const noexcept {
25015  return condition;
25016  }
25017 
25018  /**
25019  * \brief Getter for member variable \ref ElseIfStatement.statement_block
25020  */
25021  const std::shared_ptr<StatementBlock> &get_statement_block() const
25022  noexcept override {
25023  return statement_block;
25024  }
25025 
25026  /// \}
25027 
25028  /// \name Setters
25029  /// \{
25030 
25031  /**
25032  * \brief Set token for the current ast node
25033  */
25034  void set_token(const ModToken &tok) {
25035  token = std::make_shared<ModToken>(tok);
25036  }
25037 
25038  /**
25039  * \brief Setter for member variable \ref ElseIfStatement.condition (rvalue
25040  * reference)
25041  */
25042  void set_condition(std::shared_ptr<Expression> &&condition);
25043 
25044  /**
25045  * \brief Setter for member variable \ref ElseIfStatement.condition
25046  */
25047  void set_condition(const std::shared_ptr<Expression> &condition);
25048 
25049  /**
25050  * \brief Setter for member variable \ref ElseIfStatement.statement_block
25051  * (rvalue reference)
25052  */
25053  void set_statement_block(std::shared_ptr<StatementBlock> &&statement_block);
25054 
25055  /**
25056  * \brief Setter for member variable \ref ElseIfStatement.statement_block
25057  */
25058  void
25059  set_statement_block(const std::shared_ptr<StatementBlock> &statement_block);
25060 
25061  /// \}
25062 
25063  /// \name Visitor
25064  /// \{
25065 
25066  /**
25067  * \brief visit children i.e. member variables of current node using provided
25068  * visitor
25069  *
25070  * Different nodes in the AST have different members (i.e. children). This
25071  * method recursively visits children using provided visitor.
25072  *
25073  * \param v Concrete visitor that will be used to recursively visit children
25074  *
25075  * \sa Ast::visit_children for example.
25076  */
25077  void visit_children(visitor::Visitor &v) override;
25078 
25079  /**
25080  * \brief visit children i.e. member variables of current node using provided
25081  * visitor
25082  *
25083  * Different nodes in the AST have different members (i.e. children). This
25084  * method recursively visits children using provided visitor.
25085  *
25086  * \param v Concrete constant visitor that will be used to recursively visit
25087  * children
25088  *
25089  * \sa Ast::visit_children for example.
25090  */
25091  void visit_children(visitor::ConstVisitor &v) const override;
25092 
25093  /**
25094  * \brief accept (or visit) the current AST node using provided visitor
25095  *
25096  * Instead of visiting children of AST node, like Ast::visit_children,
25097  * accept allows to visit the current node itself using provided concrete
25098  * visitor.
25099  *
25100  * \param v Concrete visitor that will be used to recursively visit node
25101  *
25102  * \sa Ast::accept for example.
25103  */
25104  void accept(visitor::Visitor &v) override;
25105 
25106  /**
25107  * \copydoc accept(visitor::Visitor&)
25108  */
25109  void accept(visitor::ConstVisitor &v) const override;
25110 
25111  /// \}
25112 
25113 private:
25114  /**
25115  * \brief Set this object as parent for all the children
25116  *
25117  * This should be called in every object (with children) constructor
25118  * to set parents. Since it is called only in the constructors it
25119  * should not be virtual to avoid ambiguities (issue #295).
25120  */
25121  void set_parent_in_children();
25122 };
25123 
25124 /** @} */ // end of ast_class
25125 
25126 } // namespace ast
25127 } // namespace nmodl
25128 #endif // !NMODL_AST_ELSE_IF_STATEMENT_HPP
25129 #ifndef NMODL_AST_ELSE_STATEMENT_HPP
25130 #define NMODL_AST_ELSE_STATEMENT_HPP
25131 
25132 namespace nmodl {
25133 namespace ast {
25134 
25135 /**
25136  * @addtogroup ast_class
25137  * @ingroup ast
25138  * @{
25139  */
25140 
25141 /**
25142  * \brief TODO
25143  *
25144  *
25145  */
25146 class ElseStatement : public Statement {
25147 private:
25148  /// TODO
25149  std::shared_ptr<StatementBlock> statement_block;
25150  /// token with location information
25151  std::shared_ptr<ModToken> token;
25152 
25153 public:
25154  /// \name Ctor & dtor
25155  /// \{
25156 
25157  explicit ElseStatement(StatementBlock *statement_block);
25158  explicit ElseStatement(
25159  const std::shared_ptr<StatementBlock> &statement_block);
25160  ElseStatement(const ElseStatement &obj);
25161 
25162  virtual ~ElseStatement() = default;
25163 
25164  /// \}
25165 
25166  /**
25167  * \brief Check if the ast node is an instance of ast::ElseStatement
25168  * \return true as object is of type ast::ElseStatement
25169  */
25170  bool is_else_statement() const noexcept override { return true; }
25171 
25172  /**
25173  * \brief Return a copy of the current node
25174  *
25175  * Recursively make a new copy/clone of the current node including
25176  * all members and return a pointer to the node. This is used for
25177  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
25178  * ast.
25179  *
25180  * @return pointer to the clone/copy of the current node
25181  */
25182  ElseStatement *clone() const override { return new ElseStatement(*this); }
25183 
25184  /// \name Getters
25185  /// \{
25186 
25187  /**
25188  * \brief Return type (ast::AstNodeType) of ast node
25189  *
25190  * Every node in the ast has a type defined in ast::AstNodeType and this
25191  * function is used to retrieve the same.
25192  *
25193  * \return ast node type i.e. ast::AstNodeType::ELSE_STATEMENT
25194  *
25195  * \sa Ast::get_node_type_name
25196  */
25197  AstNodeType get_node_type() const noexcept override {
25199  }
25200 
25201  /**
25202  * \brief Return type (ast::AstNodeType) of ast node as std::string
25203  *
25204  * Every node in the ast has a type defined in ast::AstNodeType.
25205  * This type name can be returned as a std::string for printing
25206  * node to text/json form.
25207  *
25208  * \return name of the node type as a string i.e. "ElseStatement"
25209  *
25210  * \sa Ast::get_node_name
25211  */
25212  std::string get_node_type_name() const noexcept override {
25213  return "ElseStatement";
25214  }
25215 
25216  /**
25217  * \brief Return NMODL statement of ast node as std::string
25218  *
25219  * Every node is related to a special statement in the NMODL. This
25220  * statement can be returned as a std::string for printing to
25221  * text/json form.
25222  *
25223  * \return name of the statement as a string i.e. " ELSE "
25224  *
25225  * \sa Ast::get_nmodl_name
25226  */
25227  std::string get_nmodl_name() const noexcept override { return " ELSE "; }
25228 
25229  /**
25230  * \brief Get std::shared_ptr from `this` pointer of the current ast node
25231  */
25232  std::shared_ptr<Ast> get_shared_ptr() override {
25233  return std::static_pointer_cast<ElseStatement>(shared_from_this());
25234  }
25235 
25236  /**
25237  * \brief Get std::shared_ptr from `this` pointer of the current ast node
25238  */
25239  std::shared_ptr<const Ast> get_shared_ptr() const override {
25240  return std::static_pointer_cast<const ElseStatement>(shared_from_this());
25241  }
25242 
25243  /**
25244  * \brief Return associated token for the current ast node
25245  *
25246  * Not all ast nodes have token information. For example,
25247  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
25248  * solution of ODEs. In this case, we return nullptr to store in the
25249  * nmodl::symtab::SymbolTable.
25250  *
25251  * \return pointer to token if exist otherwise nullptr
25252  */
25253  const ModToken *get_token() const noexcept override { return token.get(); }
25254 
25255  /**
25256  * \brief Getter for member variable \ref ElseStatement.statement_block
25257  */
25258  const std::shared_ptr<StatementBlock> &get_statement_block() const
25259  noexcept override {
25260  return statement_block;
25261  }
25262 
25263  /// \}
25264 
25265  /// \name Setters
25266  /// \{
25267 
25268  /**
25269  * \brief Set token for the current ast node
25270  */
25271  void set_token(const ModToken &tok) {
25272  token = std::make_shared<ModToken>(tok);
25273  }
25274 
25275  /**
25276  * \brief Setter for member variable \ref ElseStatement.statement_block
25277  * (rvalue reference)
25278  */
25279  void set_statement_block(std::shared_ptr<StatementBlock> &&statement_block);
25280 
25281  /**
25282  * \brief Setter for member variable \ref ElseStatement.statement_block
25283  */
25284  void
25285  set_statement_block(const std::shared_ptr<StatementBlock> &statement_block);
25286 
25287  /// \}
25288 
25289  /// \name Visitor
25290  /// \{
25291 
25292  /**
25293  * \brief visit children i.e. member variables of current node using provided
25294  * visitor
25295  *
25296  * Different nodes in the AST have different members (i.e. children). This
25297  * method recursively visits children using provided visitor.
25298  *
25299  * \param v Concrete visitor that will be used to recursively visit children
25300  *
25301  * \sa Ast::visit_children for example.
25302  */
25303  void visit_children(visitor::Visitor &v) override;
25304 
25305  /**
25306  * \brief visit children i.e. member variables of current node using provided
25307  * visitor
25308  *
25309  * Different nodes in the AST have different members (i.e. children). This
25310  * method recursively visits children using provided visitor.
25311  *
25312  * \param v Concrete constant visitor that will be used to recursively visit
25313  * children
25314  *
25315  * \sa Ast::visit_children for example.
25316  */
25317  void visit_children(visitor::ConstVisitor &v) const override;
25318 
25319  /**
25320  * \brief accept (or visit) the current AST node using provided visitor
25321  *
25322  * Instead of visiting children of AST node, like Ast::visit_children,
25323  * accept allows to visit the current node itself using provided concrete
25324  * visitor.
25325  *
25326  * \param v Concrete visitor that will be used to recursively visit node
25327  *
25328  * \sa Ast::accept for example.
25329  */
25330  void accept(visitor::Visitor &v) override;
25331 
25332  /**
25333  * \copydoc accept(visitor::Visitor&)
25334  */
25335  void accept(visitor::ConstVisitor &v) const override;
25336 
25337  /// \}
25338 
25339 private:
25340  /**
25341  * \brief Set this object as parent for all the children
25342  *
25343  * This should be called in every object (with children) constructor
25344  * to set parents. Since it is called only in the constructors it
25345  * should not be virtual to avoid ambiguities (issue #295).
25346  */
25347  void set_parent_in_children();
25348 };
25349 
25350 /** @} */ // end of ast_class
25351 
25352 } // namespace ast
25353 } // namespace nmodl
25354 #endif // !NMODL_AST_ELSE_STATEMENT_HPP
25355 #ifndef NMODL_AST_PARTIAL_EQUATION_HPP
25356 #define NMODL_AST_PARTIAL_EQUATION_HPP
25357 
25358 namespace nmodl {
25359 namespace ast {
25360 
25361 /**
25362  * @addtogroup ast_class
25363  * @ingroup ast
25364  * @{
25365  */
25366 
25367 /**
25368  * \brief TODO
25369  *
25370  *
25371  */
25372 class PartialEquation : public Statement {
25373 private:
25374  /// TODO
25375  std::shared_ptr<PrimeName> prime;
25376  /// TODO
25377  std::shared_ptr<Name> name1;
25378  /// TODO
25379  std::shared_ptr<Name> name2;
25380  /// TODO
25381  std::shared_ptr<Name> name3;
25382  /// token with location information
25383  std::shared_ptr<ModToken> token;
25384 
25385 public:
25386  /// \name Ctor & dtor
25387  /// \{
25388 
25389  explicit PartialEquation(PrimeName *prime, Name *name1, Name *name2,
25390  Name *name3);
25391  explicit PartialEquation(const std::shared_ptr<PrimeName> &prime,
25392  const std::shared_ptr<Name> &name1,
25393  const std::shared_ptr<Name> &name2,
25394  const std::shared_ptr<Name> &name3);
25395  PartialEquation(const PartialEquation &obj);
25396 
25397  virtual ~PartialEquation() = default;
25398 
25399  /// \}
25400 
25401  /**
25402  * \brief Check if the ast node is an instance of ast::PartialEquation
25403  * \return true as object is of type ast::PartialEquation
25404  */
25405  bool is_partial_equation() const noexcept override { return true; }
25406 
25407  /**
25408  * \brief Return a copy of the current node
25409  *
25410  * Recursively make a new copy/clone of the current node including
25411  * all members and return a pointer to the node. This is used for
25412  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
25413  * ast.
25414  *
25415  * @return pointer to the clone/copy of the current node
25416  */
25417  PartialEquation *clone() const override { return new PartialEquation(*this); }
25418 
25419  /// \name Getters
25420  /// \{
25421 
25422  /**
25423  * \brief Return type (ast::AstNodeType) of ast node
25424  *
25425  * Every node in the ast has a type defined in ast::AstNodeType and this
25426  * function is used to retrieve the same.
25427  *
25428  * \return ast node type i.e. ast::AstNodeType::PARTIAL_EQUATION
25429  *
25430  * \sa Ast::get_node_type_name
25431  */
25432  AstNodeType get_node_type() const noexcept override {
25434  }
25435 
25436  /**
25437  * \brief Return type (ast::AstNodeType) of ast node as std::string
25438  *
25439  * Every node in the ast has a type defined in ast::AstNodeType.
25440  * This type name can be returned as a std::string for printing
25441  * node to text/json form.
25442  *
25443  * \return name of the node type as a string i.e. "PartialEquation"
25444  *
25445  * \sa Ast::get_node_name
25446  */
25447  std::string get_node_type_name() const noexcept override {
25448  return "PartialEquation";
25449  }
25450 
25451  /**
25452  * \brief Get std::shared_ptr from `this` pointer of the current ast node
25453  */
25454  std::shared_ptr<Ast> get_shared_ptr() override {
25455  return std::static_pointer_cast<PartialEquation>(shared_from_this());
25456  }
25457 
25458  /**
25459  * \brief Get std::shared_ptr from `this` pointer of the current ast node
25460  */
25461  std::shared_ptr<const Ast> get_shared_ptr() const override {
25462  return std::static_pointer_cast<const PartialEquation>(shared_from_this());
25463  }
25464 
25465  /**
25466  * \brief Return associated token for the current ast node
25467  *
25468  * Not all ast nodes have token information. For example,
25469  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
25470  * solution of ODEs. In this case, we return nullptr to store in the
25471  * nmodl::symtab::SymbolTable.
25472  *
25473  * \return pointer to token if exist otherwise nullptr
25474  */
25475  const ModToken *get_token() const noexcept override { return token.get(); }
25476 
25477  /**
25478  * \brief Getter for member variable \ref PartialEquation.prime
25479  */
25480  const std::shared_ptr<PrimeName> &get_prime() const noexcept { return prime; }
25481 
25482  /**
25483  * \brief Getter for member variable \ref PartialEquation.name1
25484  */
25485  const std::shared_ptr<Name> &get_name1() const noexcept { return name1; }
25486 
25487  /**
25488  * \brief Getter for member variable \ref PartialEquation.name2
25489  */
25490  const std::shared_ptr<Name> &get_name2() const noexcept { return name2; }
25491 
25492  /**
25493  * \brief Getter for member variable \ref PartialEquation.name3
25494  */
25495  const std::shared_ptr<Name> &get_name3() const noexcept { return name3; }
25496 
25497  /// \}
25498 
25499  /// \name Setters
25500  /// \{
25501 
25502  /**
25503  * \brief Set token for the current ast node
25504  */
25505  void set_token(const ModToken &tok) {
25506  token = std::make_shared<ModToken>(tok);
25507  }
25508 
25509  /**
25510  * \brief Setter for member variable \ref PartialEquation.prime (rvalue
25511  * reference)
25512  */
25513  void set_prime(std::shared_ptr<PrimeName> &&prime);
25514 
25515  /**
25516  * \brief Setter for member variable \ref PartialEquation.prime
25517  */
25518  void set_prime(const std::shared_ptr<PrimeName> &prime);
25519 
25520  /**
25521  * \brief Setter for member variable \ref PartialEquation.name1 (rvalue
25522  * reference)
25523  */
25524  void set_name1(std::shared_ptr<Name> &&name1);
25525 
25526  /**
25527  * \brief Setter for member variable \ref PartialEquation.name1
25528  */
25529  void set_name1(const std::shared_ptr<Name> &name1);
25530 
25531  /**
25532  * \brief Setter for member variable \ref PartialEquation.name2 (rvalue
25533  * reference)
25534  */
25535  void set_name2(std::shared_ptr<Name> &&name2);
25536 
25537  /**
25538  * \brief Setter for member variable \ref PartialEquation.name2
25539  */
25540  void set_name2(const std::shared_ptr<Name> &name2);
25541 
25542  /**
25543  * \brief Setter for member variable \ref PartialEquation.name3 (rvalue
25544  * reference)
25545  */
25546  void set_name3(std::shared_ptr<Name> &&name3);
25547 
25548  /**
25549  * \brief Setter for member variable \ref PartialEquation.name3
25550  */
25551  void set_name3(const std::shared_ptr<Name> &name3);
25552 
25553  /// \}
25554 
25555  /// \name Visitor
25556  /// \{
25557 
25558  /**
25559  * \brief visit children i.e. member variables of current node using provided
25560  * visitor
25561  *
25562  * Different nodes in the AST have different members (i.e. children). This
25563  * method recursively visits children using provided visitor.
25564  *
25565  * \param v Concrete visitor that will be used to recursively visit children
25566  *
25567  * \sa Ast::visit_children for example.
25568  */
25569  void visit_children(visitor::Visitor &v) override;
25570 
25571  /**
25572  * \brief visit children i.e. member variables of current node using provided
25573  * visitor
25574  *
25575  * Different nodes in the AST have different members (i.e. children). This
25576  * method recursively visits children using provided visitor.
25577  *
25578  * \param v Concrete constant visitor that will be used to recursively visit
25579  * children
25580  *
25581  * \sa Ast::visit_children for example.
25582  */
25583  void visit_children(visitor::ConstVisitor &v) const override;
25584 
25585  /**
25586  * \brief accept (or visit) the current AST node using provided visitor
25587  *
25588  * Instead of visiting children of AST node, like Ast::visit_children,
25589  * accept allows to visit the current node itself using provided concrete
25590  * visitor.
25591  *
25592  * \param v Concrete visitor that will be used to recursively visit node
25593  *
25594  * \sa Ast::accept for example.
25595  */
25596  void accept(visitor::Visitor &v) override;
25597 
25598  /**
25599  * \copydoc accept(visitor::Visitor&)
25600  */
25601  void accept(visitor::ConstVisitor &v) const override;
25602 
25603  /// \}
25604 
25605 private:
25606  /**
25607  * \brief Set this object as parent for all the children
25608  *
25609  * This should be called in every object (with children) constructor
25610  * to set parents. Since it is called only in the constructors it
25611  * should not be virtual to avoid ambiguities (issue #295).
25612  */
25613  void set_parent_in_children();
25614 };
25615 
25616 /** @} */ // end of ast_class
25617 
25618 } // namespace ast
25619 } // namespace nmodl
25620 #endif // !NMODL_AST_PARTIAL_EQUATION_HPP
25621 #ifndef NMODL_AST_PARTIAL_BOUNDARY_HPP
25622 #define NMODL_AST_PARTIAL_BOUNDARY_HPP
25623 
25624 namespace nmodl {
25625 namespace ast {
25626 
25627 /**
25628  * @addtogroup ast_class
25629  * @ingroup ast
25630  * @{
25631  */
25632 
25633 /**
25634  * \brief TODO
25635  *
25636  *
25637  */
25638 class PartialBoundary : public Statement {
25639 private:
25640  /// TODO
25641  std::shared_ptr<Name> del;
25642  /// TODO
25643  std::shared_ptr<Identifier> name;
25644  /// TODO
25645  std::shared_ptr<FirstLastTypeIndex> index;
25646  /// TODO
25647  std::shared_ptr<Expression> expression;
25648  /// TODO
25649  std::shared_ptr<Name> name1;
25650  /// TODO
25651  std::shared_ptr<Name> del2;
25652  /// TODO
25653  std::shared_ptr<Name> name2;
25654  /// TODO
25655  std::shared_ptr<Name> name3;
25656  /// token with location information
25657  std::shared_ptr<ModToken> token;
25658 
25659 public:
25660  /// \name Ctor & dtor
25661  /// \{
25662 
25663  explicit PartialBoundary(Name *del, Identifier *name,
25664  FirstLastTypeIndex *index, Expression *expression,
25665  Name *name1, Name *del2, Name *name2, Name *name3);
25666  explicit PartialBoundary(const std::shared_ptr<Name> &del,
25667  const std::shared_ptr<Identifier> &name,
25668  const std::shared_ptr<FirstLastTypeIndex> &index,
25669  const std::shared_ptr<Expression> &expression,
25670  const std::shared_ptr<Name> &name1,
25671  const std::shared_ptr<Name> &del2,
25672  const std::shared_ptr<Name> &name2,
25673  const std::shared_ptr<Name> &name3);
25674  PartialBoundary(const PartialBoundary &obj);
25675 
25676  virtual ~PartialBoundary() = default;
25677 
25678  /// \}
25679 
25680  /**
25681  * \brief Check if the ast node is an instance of ast::PartialBoundary
25682  * \return true as object is of type ast::PartialBoundary
25683  */
25684  bool is_partial_boundary() const noexcept override { return true; }
25685 
25686  /**
25687  * \brief Return a copy of the current node
25688  *
25689  * Recursively make a new copy/clone of the current node including
25690  * all members and return a pointer to the node. This is used for
25691  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
25692  * ast.
25693  *
25694  * @return pointer to the clone/copy of the current node
25695  */
25696  PartialBoundary *clone() const override { return new PartialBoundary(*this); }
25697 
25698  /// \name Getters
25699  /// \{
25700 
25701  /**
25702  * \brief Return type (ast::AstNodeType) of ast node
25703  *
25704  * Every node in the ast has a type defined in ast::AstNodeType and this
25705  * function is used to retrieve the same.
25706  *
25707  * \return ast node type i.e. ast::AstNodeType::PARTIAL_BOUNDARY
25708  *
25709  * \sa Ast::get_node_type_name
25710  */
25711  AstNodeType get_node_type() const noexcept override {
25713  }
25714 
25715  /**
25716  * \brief Return type (ast::AstNodeType) of ast node as std::string
25717  *
25718  * Every node in the ast has a type defined in ast::AstNodeType.
25719  * This type name can be returned as a std::string for printing
25720  * node to text/json form.
25721  *
25722  * \return name of the node type as a string i.e. "PartialBoundary"
25723  *
25724  * \sa Ast::get_node_name
25725  */
25726  std::string get_node_type_name() const noexcept override {
25727  return "PartialBoundary";
25728  }
25729 
25730  /**
25731  * \brief Return NMODL statement of ast node as std::string
25732  *
25733  * Every node is related to a special statement in the NMODL. This
25734  * statement can be returned as a std::string for printing to
25735  * text/json form.
25736  *
25737  * \return name of the statement as a string i.e. "~ "
25738  *
25739  * \sa Ast::get_nmodl_name
25740  */
25741  std::string get_nmodl_name() const noexcept override { return "~ "; }
25742 
25743  /**
25744  * \brief Get std::shared_ptr from `this` pointer of the current ast node
25745  */
25746  std::shared_ptr<Ast> get_shared_ptr() override {
25747  return std::static_pointer_cast<PartialBoundary>(shared_from_this());
25748  }
25749 
25750  /**
25751  * \brief Get std::shared_ptr from `this` pointer of the current ast node
25752  */
25753  std::shared_ptr<const Ast> get_shared_ptr() const override {
25754  return std::static_pointer_cast<const PartialBoundary>(shared_from_this());
25755  }
25756 
25757  /**
25758  * \brief Return associated token for the current ast node
25759  *
25760  * Not all ast nodes have token information. For example,
25761  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
25762  * solution of ODEs. In this case, we return nullptr to store in the
25763  * nmodl::symtab::SymbolTable.
25764  *
25765  * \return pointer to token if exist otherwise nullptr
25766  */
25767  const ModToken *get_token() const noexcept override { return token.get(); }
25768 
25769  /**
25770  * \brief Getter for member variable \ref PartialBoundary.del
25771  */
25772  const std::shared_ptr<Name> &get_del() const noexcept { return del; }
25773 
25774  /**
25775  * \brief Getter for member variable \ref PartialBoundary.name
25776  */
25777  const std::shared_ptr<Identifier> &get_name() const noexcept { return name; }
25778 
25779  /**
25780  * \brief Getter for member variable \ref PartialBoundary.index
25781  */
25782  const std::shared_ptr<FirstLastTypeIndex> &get_index() const noexcept {
25783  return index;
25784  }
25785 
25786  /**
25787  * \brief Getter for member variable \ref PartialBoundary.expression
25788  */
25789  const std::shared_ptr<Expression> &get_expression() const noexcept {
25790  return expression;
25791  }
25792 
25793  /**
25794  * \brief Getter for member variable \ref PartialBoundary.name1
25795  */
25796  const std::shared_ptr<Name> &get_name1() const noexcept { return name1; }
25797 
25798  /**
25799  * \brief Getter for member variable \ref PartialBoundary.del2
25800  */
25801  const std::shared_ptr<Name> &get_del2() const noexcept { return del2; }
25802 
25803  /**
25804  * \brief Getter for member variable \ref PartialBoundary.name2
25805  */
25806  const std::shared_ptr<Name> &get_name2() const noexcept { return name2; }
25807 
25808  /**
25809  * \brief Getter for member variable \ref PartialBoundary.name3
25810  */
25811  const std::shared_ptr<Name> &get_name3() const noexcept { return name3; }
25812 
25813  /// \}
25814 
25815  /// \name Setters
25816  /// \{
25817 
25818  /**
25819  * \brief Set token for the current ast node
25820  */
25821  void set_token(const ModToken &tok) {
25822  token = std::make_shared<ModToken>(tok);
25823  }
25824 
25825  /**
25826  * \brief Setter for member variable \ref PartialBoundary.del (rvalue
25827  * reference)
25828  */
25829  void set_del(std::shared_ptr<Name> &&del);
25830 
25831  /**
25832  * \brief Setter for member variable \ref PartialBoundary.del
25833  */
25834  void set_del(const std::shared_ptr<Name> &del);
25835 
25836  /**
25837  * \brief Setter for member variable \ref PartialBoundary.name (rvalue
25838  * reference)
25839  */
25840  void set_name(std::shared_ptr<Identifier> &&name);
25841 
25842  /**
25843  * \brief Setter for member variable \ref PartialBoundary.name
25844  */
25845  void set_name(const std::shared_ptr<Identifier> &name);
25846 
25847  /**
25848  * \brief Setter for member variable \ref PartialBoundary.index (rvalue
25849  * reference)
25850  */
25851  void set_index(std::shared_ptr<FirstLastTypeIndex> &&index);
25852 
25853  /**
25854  * \brief Setter for member variable \ref PartialBoundary.index
25855  */
25856  void set_index(const std::shared_ptr<FirstLastTypeIndex> &index);
25857 
25858  /**
25859  * \brief Setter for member variable \ref PartialBoundary.expression (rvalue
25860  * reference)
25861  */
25862  void set_expression(std::shared_ptr<Expression> &&expression);
25863 
25864  /**
25865  * \brief Setter for member variable \ref PartialBoundary.expression
25866  */
25867  void set_expression(const std::shared_ptr<Expression> &expression);
25868 
25869  /**
25870  * \brief Setter for member variable \ref PartialBoundary.name1 (rvalue
25871  * reference)
25872  */
25873  void set_name1(std::shared_ptr<Name> &&name1);
25874 
25875  /**
25876  * \brief Setter for member variable \ref PartialBoundary.name1
25877  */
25878  void set_name1(const std::shared_ptr<Name> &name1);
25879 
25880  /**
25881  * \brief Setter for member variable \ref PartialBoundary.del2 (rvalue
25882  * reference)
25883  */
25884  void set_del2(std::shared_ptr<Name> &&del2);
25885 
25886  /**
25887  * \brief Setter for member variable \ref PartialBoundary.del2
25888  */
25889  void set_del2(const std::shared_ptr<Name> &del2);
25890 
25891  /**
25892  * \brief Setter for member variable \ref PartialBoundary.name2 (rvalue
25893  * reference)
25894  */
25895  void set_name2(std::shared_ptr<Name> &&name2);
25896 
25897  /**
25898  * \brief Setter for member variable \ref PartialBoundary.name2
25899  */
25900  void set_name2(const std::shared_ptr<Name> &name2);
25901 
25902  /**
25903  * \brief Setter for member variable \ref PartialBoundary.name3 (rvalue
25904  * reference)
25905  */
25906  void set_name3(std::shared_ptr<Name> &&name3);
25907 
25908  /**
25909  * \brief Setter for member variable \ref PartialBoundary.name3
25910  */
25911  void set_name3(const std::shared_ptr<Name> &name3);
25912 
25913  /// \}
25914 
25915  /// \name Visitor
25916  /// \{
25917 
25918  /**
25919  * \brief visit children i.e. member variables of current node using provided
25920  * visitor
25921  *
25922  * Different nodes in the AST have different members (i.e. children). This
25923  * method recursively visits children using provided visitor.
25924  *
25925  * \param v Concrete visitor that will be used to recursively visit children
25926  *
25927  * \sa Ast::visit_children for example.
25928  */
25929  void visit_children(visitor::Visitor &v) override;
25930 
25931  /**
25932  * \brief visit children i.e. member variables of current node using provided
25933  * visitor
25934  *
25935  * Different nodes in the AST have different members (i.e. children). This
25936  * method recursively visits children using provided visitor.
25937  *
25938  * \param v Concrete constant visitor that will be used to recursively visit
25939  * children
25940  *
25941  * \sa Ast::visit_children for example.
25942  */
25943  void visit_children(visitor::ConstVisitor &v) const override;
25944 
25945  /**
25946  * \brief accept (or visit) the current AST node using provided visitor
25947  *
25948  * Instead of visiting children of AST node, like Ast::visit_children,
25949  * accept allows to visit the current node itself using provided concrete
25950  * visitor.
25951  *
25952  * \param v Concrete visitor that will be used to recursively visit node
25953  *
25954  * \sa Ast::accept for example.
25955  */
25956  void accept(visitor::Visitor &v) override;
25957 
25958  /**
25959  * \copydoc accept(visitor::Visitor&)
25960  */
25961  void accept(visitor::ConstVisitor &v) const override;
25962 
25963  /// \}
25964 
25965 private:
25966  /**
25967  * \brief Set this object as parent for all the children
25968  *
25969  * This should be called in every object (with children) constructor
25970  * to set parents. Since it is called only in the constructors it
25971  * should not be virtual to avoid ambiguities (issue #295).
25972  */
25973  void set_parent_in_children();
25974 };
25975 
25976 /** @} */ // end of ast_class
25977 
25978 } // namespace ast
25979 } // namespace nmodl
25980 #endif // !NMODL_AST_PARTIAL_BOUNDARY_HPP
25981 #ifndef NMODL_AST_WATCH_STATEMENT_HPP
25982 #define NMODL_AST_WATCH_STATEMENT_HPP
25983 #define NMODL_AST_WATCH_STATEMENT_HPP_INLINE_DEFINITION_REQUIRED
25984 
25985 namespace nmodl {
25986 namespace ast {
25987 
25988 /**
25989  * @addtogroup ast_class
25990  * @ingroup ast
25991  * @{
25992  */
25993 
25994 /**
25995  * \brief Represent WATCH statement in NMODL
25996  *
25997  *
25998  */
25999 class WatchStatement : public Statement {
26000 private:
26001  /// Vector of watch statements
26003  /// token with location information
26004  std::shared_ptr<ModToken> token;
26005 
26006 public:
26007  /// \name Ctor & dtor
26008  /// \{
26009 
26010  explicit WatchStatement(WatchVector statements);
26011  WatchStatement(const WatchStatement &obj);
26012 
26013  virtual ~WatchStatement() = default;
26014 
26015  /// \}
26016 
26017  /**
26018  * \brief Check if the ast node is an instance of ast::WatchStatement
26019  * \return true as object is of type ast::WatchStatement
26020  */
26021  bool is_watch_statement() const noexcept override { return true; }
26022 
26023  /**
26024  * \brief Return a copy of the current node
26025  *
26026  * Recursively make a new copy/clone of the current node including
26027  * all members and return a pointer to the node. This is used for
26028  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
26029  * ast.
26030  *
26031  * @return pointer to the clone/copy of the current node
26032  */
26033  WatchStatement *clone() const override { return new WatchStatement(*this); }
26034 
26035  /// \name Getters
26036  /// \{
26037 
26038  /**
26039  * \brief Return type (ast::AstNodeType) of ast node
26040  *
26041  * Every node in the ast has a type defined in ast::AstNodeType and this
26042  * function is used to retrieve the same.
26043  *
26044  * \return ast node type i.e. ast::AstNodeType::WATCH_STATEMENT
26045  *
26046  * \sa Ast::get_node_type_name
26047  */
26048  AstNodeType get_node_type() const noexcept override {
26050  }
26051 
26052  /**
26053  * \brief Return type (ast::AstNodeType) of ast node as std::string
26054  *
26055  * Every node in the ast has a type defined in ast::AstNodeType.
26056  * This type name can be returned as a std::string for printing
26057  * node to text/json form.
26058  *
26059  * \return name of the node type as a string i.e. "WatchStatement"
26060  *
26061  * \sa Ast::get_node_name
26062  */
26063  std::string get_node_type_name() const noexcept override {
26064  return "WatchStatement";
26065  }
26066 
26067  /**
26068  * \brief Return NMODL statement of ast node as std::string
26069  *
26070  * Every node is related to a special statement in the NMODL. This
26071  * statement can be returned as a std::string for printing to
26072  * text/json form.
26073  *
26074  * \return name of the statement as a string i.e. "WATCH "
26075  *
26076  * \sa Ast::get_nmodl_name
26077  */
26078  std::string get_nmodl_name() const noexcept override { return "WATCH "; }
26079 
26080  /**
26081  * \brief Get std::shared_ptr from `this` pointer of the current ast node
26082  */
26083  std::shared_ptr<Ast> get_shared_ptr() override {
26084  return std::static_pointer_cast<WatchStatement>(shared_from_this());
26085  }
26086 
26087  /**
26088  * \brief Get std::shared_ptr from `this` pointer of the current ast node
26089  */
26090  std::shared_ptr<const Ast> get_shared_ptr() const override {
26091  return std::static_pointer_cast<const WatchStatement>(shared_from_this());
26092  }
26093 
26094  /**
26095  * \brief Return associated token for the current ast node
26096  *
26097  * Not all ast nodes have token information. For example,
26098  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
26099  * solution of ODEs. In this case, we return nullptr to store in the
26100  * nmodl::symtab::SymbolTable.
26101  *
26102  * \return pointer to token if exist otherwise nullptr
26103  */
26104  const ModToken *get_token() const noexcept override { return token.get(); }
26105 
26106  /**
26107  * \brief Add member to statements by raw pointer
26108  */
26109  void emplace_back_watch(Watch *n);
26110 
26111  /**
26112  * \brief Add member to statements by shared_ptr
26113  */
26114  void emplace_back_watch(std::shared_ptr<Watch> n);
26115 
26116  /**
26117  * \brief Erase member to statements
26118  */
26119  WatchVector::const_iterator erase_watch(WatchVector::const_iterator first);
26120 
26121  /**
26122  * \brief Erase members to statements
26123  */
26124  WatchVector::const_iterator erase_watch(WatchVector::const_iterator first,
26125  WatchVector::const_iterator last);
26126 
26127  /**
26128  * \brief Erase non-consecutive members to statements
26129  *
26130  * loosely following the cpp reference of remove_if
26131  */
26132  size_t erase_watch(std::unordered_set<Watch *> &to_be_erased);
26133 
26134  /**
26135  * \brief Insert member to statements
26136  */
26137  WatchVector::const_iterator insert_watch(WatchVector::const_iterator position,
26138  const std::shared_ptr<Watch> &n);
26139 
26140  /**
26141  * \brief Insert members to statements
26142  */
26143  template <class NodeType, class InputIterator>
26144  void insert_watch(WatchVector::const_iterator position, NodeType &to,
26145  InputIterator first, InputIterator last);
26146 
26147  /**
26148  * \brief Reset member to statements
26149  */
26150  void reset_watch(WatchVector::const_iterator position, Watch *n);
26151 
26152  /**
26153  * \brief Reset member to statements
26154  */
26155  void reset_watch(WatchVector::const_iterator position,
26156  std::shared_ptr<Watch> n);
26157 
26158  /**
26159  * \brief Getter for member variable \ref WatchStatement.statements
26160  */
26161  const WatchVector &get_statements() const noexcept { return statements; }
26162 
26163  /// \}
26164 
26165  /// \name Setters
26166  /// \{
26167 
26168  /**
26169  * \brief Set token for the current ast node
26170  */
26171  void set_token(const ModToken &tok) {
26172  token = std::make_shared<ModToken>(tok);
26173  }
26174 
26175  /**
26176  * \brief Setter for member variable \ref WatchStatement.statements (rvalue
26177  * reference)
26178  */
26179  void set_statements(WatchVector &&statements);
26180 
26181  /**
26182  * \brief Setter for member variable \ref WatchStatement.statements
26183  */
26184  void set_statements(const WatchVector &statements);
26185 
26186  /// \}
26187 
26188  /// \name Visitor
26189  /// \{
26190 
26191  /**
26192  * \brief visit children i.e. member variables of current node using provided
26193  * visitor
26194  *
26195  * Different nodes in the AST have different members (i.e. children). This
26196  * method recursively visits children using provided visitor.
26197  *
26198  * \param v Concrete visitor that will be used to recursively visit children
26199  *
26200  * \sa Ast::visit_children for example.
26201  */
26202  void visit_children(visitor::Visitor &v) override;
26203 
26204  /**
26205  * \brief visit children i.e. member variables of current node using provided
26206  * visitor
26207  *
26208  * Different nodes in the AST have different members (i.e. children). This
26209  * method recursively visits children using provided visitor.
26210  *
26211  * \param v Concrete constant visitor that will be used to recursively visit
26212  * children
26213  *
26214  * \sa Ast::visit_children for example.
26215  */
26216  void visit_children(visitor::ConstVisitor &v) const override;
26217 
26218  /**
26219  * \brief accept (or visit) the current AST node using provided visitor
26220  *
26221  * Instead of visiting children of AST node, like Ast::visit_children,
26222  * accept allows to visit the current node itself using provided concrete
26223  * visitor.
26224  *
26225  * \param v Concrete visitor that will be used to recursively visit node
26226  *
26227  * \sa Ast::accept for example.
26228  */
26229  void accept(visitor::Visitor &v) override;
26230 
26231  /**
26232  * \copydoc accept(visitor::Visitor&)
26233  */
26234  void accept(visitor::ConstVisitor &v) const override;
26235 
26236  /// \}
26237 
26238 private:
26239  /**
26240  * \brief Set this object as parent for all the children
26241  *
26242  * This should be called in every object (with children) constructor
26243  * to set parents. Since it is called only in the constructors it
26244  * should not be virtual to avoid ambiguities (issue #295).
26245  */
26246  void set_parent_in_children();
26247 };
26248 
26249 /** @} */ // end of ast_class
26250 
26251 } // namespace ast
26252 } // namespace nmodl
26253 #endif // !NMODL_AST_WATCH_STATEMENT_HPP
26254 #ifndef NMODL_AST_MUTEX_LOCK_HPP
26255 #define NMODL_AST_MUTEX_LOCK_HPP
26256 
26257 namespace nmodl {
26258 namespace ast {
26259 
26260 /**
26261  * @addtogroup ast_class
26262  * @ingroup ast
26263  * @{
26264  */
26265 
26266 /**
26267  * \brief Represent MUTEXLOCK statement in NMODL
26268  *
26269  *
26270  */
26271 class MutexLock : public Statement {
26272 private:
26273  /// token with location information
26274  std::shared_ptr<ModToken> token;
26275 
26276 public:
26277  /// \name Ctor & dtor
26278  /// \{
26279 
26280  virtual ~MutexLock() = default;
26281 
26282  /// \}
26283 
26284  /**
26285  * \brief Check if the ast node is an instance of ast::MutexLock
26286  * \return true as object is of type ast::MutexLock
26287  */
26288  bool is_mutex_lock() const noexcept override { return true; }
26289 
26290  /**
26291  * \brief Return a copy of the current node
26292  *
26293  * Recursively make a new copy/clone of the current node including
26294  * all members and return a pointer to the node. This is used for
26295  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
26296  * ast.
26297  *
26298  * @return pointer to the clone/copy of the current node
26299  */
26300  MutexLock *clone() const override { return new MutexLock(*this); }
26301 
26302  /// \name Getters
26303  /// \{
26304 
26305  /**
26306  * \brief Return type (ast::AstNodeType) of ast node
26307  *
26308  * Every node in the ast has a type defined in ast::AstNodeType and this
26309  * function is used to retrieve the same.
26310  *
26311  * \return ast node type i.e. ast::AstNodeType::MUTEX_LOCK
26312  *
26313  * \sa Ast::get_node_type_name
26314  */
26315  AstNodeType get_node_type() const noexcept override {
26316  return AstNodeType::MUTEX_LOCK;
26317  }
26318 
26319  /**
26320  * \brief Return type (ast::AstNodeType) of ast node as std::string
26321  *
26322  * Every node in the ast has a type defined in ast::AstNodeType.
26323  * This type name can be returned as a std::string for printing
26324  * node to text/json form.
26325  *
26326  * \return name of the node type as a string i.e. "MutexLock"
26327  *
26328  * \sa Ast::get_node_name
26329  */
26330  std::string get_node_type_name() const noexcept override {
26331  return "MutexLock";
26332  }
26333 
26334  /**
26335  * \brief Return NMODL statement of ast node as std::string
26336  *
26337  * Every node is related to a special statement in the NMODL. This
26338  * statement can be returned as a std::string for printing to
26339  * text/json form.
26340  *
26341  * \return name of the statement as a string i.e. "MUTEXLOCK"
26342  *
26343  * \sa Ast::get_nmodl_name
26344  */
26345  std::string get_nmodl_name() const noexcept override { return "MUTEXLOCK"; }
26346 
26347  /**
26348  * \brief Get std::shared_ptr from `this` pointer of the current ast node
26349  */
26350  std::shared_ptr<Ast> get_shared_ptr() override {
26351  return std::static_pointer_cast<MutexLock>(shared_from_this());
26352  }
26353 
26354  /**
26355  * \brief Get std::shared_ptr from `this` pointer of the current ast node
26356  */
26357  std::shared_ptr<const Ast> get_shared_ptr() const override {
26358  return std::static_pointer_cast<const MutexLock>(shared_from_this());
26359  }
26360 
26361  /**
26362  * \brief Return associated token for the current ast node
26363  *
26364  * Not all ast nodes have token information. For example,
26365  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
26366  * solution of ODEs. In this case, we return nullptr to store in the
26367  * nmodl::symtab::SymbolTable.
26368  *
26369  * \return pointer to token if exist otherwise nullptr
26370  */
26371  const ModToken *get_token() const noexcept override { return token.get(); }
26372 
26373  /// \}
26374 
26375  /// \name Setters
26376  /// \{
26377 
26378  /**
26379  * \brief Set token for the current ast node
26380  */
26381  void set_token(const ModToken &tok) {
26382  token = std::make_shared<ModToken>(tok);
26383  }
26384 
26385  /// \}
26386 
26387  /// \name Visitor
26388  /// \{
26389 
26390  /**
26391  * \brief visit children i.e. member variables of current node using provided
26392  * visitor
26393  *
26394  * Different nodes in the AST have different members (i.e. children). This
26395  * method recursively visits children using provided visitor.
26396  *
26397  * \param v Concrete visitor that will be used to recursively visit children
26398  *
26399  * \sa Ast::visit_children for example.
26400  */
26401  void visit_children(visitor::Visitor &v) override;
26402 
26403  /**
26404  * \brief visit children i.e. member variables of current node using provided
26405  * visitor
26406  *
26407  * Different nodes in the AST have different members (i.e. children). This
26408  * method recursively visits children using provided visitor.
26409  *
26410  * \param v Concrete constant visitor that will be used to recursively visit
26411  * children
26412  *
26413  * \sa Ast::visit_children for example.
26414  */
26415  void visit_children(visitor::ConstVisitor &v) const override;
26416 
26417  /**
26418  * \brief accept (or visit) the current AST node using provided visitor
26419  *
26420  * Instead of visiting children of AST node, like Ast::visit_children,
26421  * accept allows to visit the current node itself using provided concrete
26422  * visitor.
26423  *
26424  * \param v Concrete visitor that will be used to recursively visit node
26425  *
26426  * \sa Ast::accept for example.
26427  */
26428  void accept(visitor::Visitor &v) override;
26429 
26430  /**
26431  * \copydoc accept(visitor::Visitor&)
26432  */
26433  void accept(visitor::ConstVisitor &v) const override;
26434 
26435  /// \}
26436 };
26437 
26438 /** @} */ // end of ast_class
26439 
26440 } // namespace ast
26441 } // namespace nmodl
26442 #endif // !NMODL_AST_MUTEX_LOCK_HPP
26443 #ifndef NMODL_AST_MUTEX_UNLOCK_HPP
26444 #define NMODL_AST_MUTEX_UNLOCK_HPP
26445 
26446 namespace nmodl {
26447 namespace ast {
26448 
26449 /**
26450  * @addtogroup ast_class
26451  * @ingroup ast
26452  * @{
26453  */
26454 
26455 /**
26456  * \brief Represent MUTEXUNLOCK statement in NMODL
26457  *
26458  *
26459  */
26460 class MutexUnlock : public Statement {
26461 private:
26462  /// token with location information
26463  std::shared_ptr<ModToken> token;
26464 
26465 public:
26466  /// \name Ctor & dtor
26467  /// \{
26468 
26469  virtual ~MutexUnlock() = default;
26470 
26471  /// \}
26472 
26473  /**
26474  * \brief Check if the ast node is an instance of ast::MutexUnlock
26475  * \return true as object is of type ast::MutexUnlock
26476  */
26477  bool is_mutex_unlock() const noexcept override { return true; }
26478 
26479  /**
26480  * \brief Return a copy of the current node
26481  *
26482  * Recursively make a new copy/clone of the current node including
26483  * all members and return a pointer to the node. This is used for
26484  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
26485  * ast.
26486  *
26487  * @return pointer to the clone/copy of the current node
26488  */
26489  MutexUnlock *clone() const override { return new MutexUnlock(*this); }
26490 
26491  /// \name Getters
26492  /// \{
26493 
26494  /**
26495  * \brief Return type (ast::AstNodeType) of ast node
26496  *
26497  * Every node in the ast has a type defined in ast::AstNodeType and this
26498  * function is used to retrieve the same.
26499  *
26500  * \return ast node type i.e. ast::AstNodeType::MUTEX_UNLOCK
26501  *
26502  * \sa Ast::get_node_type_name
26503  */
26504  AstNodeType get_node_type() const noexcept override {
26506  }
26507 
26508  /**
26509  * \brief Return type (ast::AstNodeType) of ast node as std::string
26510  *
26511  * Every node in the ast has a type defined in ast::AstNodeType.
26512  * This type name can be returned as a std::string for printing
26513  * node to text/json form.
26514  *
26515  * \return name of the node type as a string i.e. "MutexUnlock"
26516  *
26517  * \sa Ast::get_node_name
26518  */
26519  std::string get_node_type_name() const noexcept override {
26520  return "MutexUnlock";
26521  }
26522 
26523  /**
26524  * \brief Return NMODL statement of ast node as std::string
26525  *
26526  * Every node is related to a special statement in the NMODL. This
26527  * statement can be returned as a std::string for printing to
26528  * text/json form.
26529  *
26530  * \return name of the statement as a string i.e. "MUTEXUNLOCK"
26531  *
26532  * \sa Ast::get_nmodl_name
26533  */
26534  std::string get_nmodl_name() const noexcept override { return "MUTEXUNLOCK"; }
26535 
26536  /**
26537  * \brief Get std::shared_ptr from `this` pointer of the current ast node
26538  */
26539  std::shared_ptr<Ast> get_shared_ptr() override {
26540  return std::static_pointer_cast<MutexUnlock>(shared_from_this());
26541  }
26542 
26543  /**
26544  * \brief Get std::shared_ptr from `this` pointer of the current ast node
26545  */
26546  std::shared_ptr<const Ast> get_shared_ptr() const override {
26547  return std::static_pointer_cast<const MutexUnlock>(shared_from_this());
26548  }
26549 
26550  /**
26551  * \brief Return associated token for the current ast node
26552  *
26553  * Not all ast nodes have token information. For example,
26554  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
26555  * solution of ODEs. In this case, we return nullptr to store in the
26556  * nmodl::symtab::SymbolTable.
26557  *
26558  * \return pointer to token if exist otherwise nullptr
26559  */
26560  const ModToken *get_token() const noexcept override { return token.get(); }
26561 
26562  /// \}
26563 
26564  /// \name Setters
26565  /// \{
26566 
26567  /**
26568  * \brief Set token for the current ast node
26569  */
26570  void set_token(const ModToken &tok) {
26571  token = std::make_shared<ModToken>(tok);
26572  }
26573 
26574  /// \}
26575 
26576  /// \name Visitor
26577  /// \{
26578 
26579  /**
26580  * \brief visit children i.e. member variables of current node using provided
26581  * visitor
26582  *
26583  * Different nodes in the AST have different members (i.e. children). This
26584  * method recursively visits children using provided visitor.
26585  *
26586  * \param v Concrete visitor that will be used to recursively visit children
26587  *
26588  * \sa Ast::visit_children for example.
26589  */
26590  void visit_children(visitor::Visitor &v) override;
26591 
26592  /**
26593  * \brief visit children i.e. member variables of current node using provided
26594  * visitor
26595  *
26596  * Different nodes in the AST have different members (i.e. children). This
26597  * method recursively visits children using provided visitor.
26598  *
26599  * \param v Concrete constant visitor that will be used to recursively visit
26600  * children
26601  *
26602  * \sa Ast::visit_children for example.
26603  */
26604  void visit_children(visitor::ConstVisitor &v) const override;
26605 
26606  /**
26607  * \brief accept (or visit) the current AST node using provided visitor
26608  *
26609  * Instead of visiting children of AST node, like Ast::visit_children,
26610  * accept allows to visit the current node itself using provided concrete
26611  * visitor.
26612  *
26613  * \param v Concrete visitor that will be used to recursively visit node
26614  *
26615  * \sa Ast::accept for example.
26616  */
26617  void accept(visitor::Visitor &v) override;
26618 
26619  /**
26620  * \copydoc accept(visitor::Visitor&)
26621  */
26622  void accept(visitor::ConstVisitor &v) const override;
26623 
26624  /// \}
26625 };
26626 
26627 /** @} */ // end of ast_class
26628 
26629 } // namespace ast
26630 } // namespace nmodl
26631 #endif // !NMODL_AST_MUTEX_UNLOCK_HPP
26632 #ifndef NMODL_AST_RESET_HPP
26633 #define NMODL_AST_RESET_HPP
26634 
26635 namespace nmodl {
26636 namespace ast {
26637 
26638 /**
26639  * @addtogroup ast_class
26640  * @ingroup ast
26641  * @{
26642  */
26643 
26644 /**
26645  * \brief Represent RESET statement in NMODL
26646  *
26647  *
26648  */
26649 class Reset : public Statement {
26650 private:
26651  /// token with location information
26652  std::shared_ptr<ModToken> token;
26653 
26654 public:
26655  /// \name Ctor & dtor
26656  /// \{
26657 
26658  virtual ~Reset() = default;
26659 
26660  /// \}
26661 
26662  /**
26663  * \brief Check if the ast node is an instance of ast::Reset
26664  * \return true as object is of type ast::Reset
26665  */
26666  bool is_reset() const noexcept override { return true; }
26667 
26668  /**
26669  * \brief Return a copy of the current node
26670  *
26671  * Recursively make a new copy/clone of the current node including
26672  * all members and return a pointer to the node. This is used for
26673  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
26674  * ast.
26675  *
26676  * @return pointer to the clone/copy of the current node
26677  */
26678  Reset *clone() const override { return new Reset(*this); }
26679 
26680  /// \name Getters
26681  /// \{
26682 
26683  /**
26684  * \brief Return type (ast::AstNodeType) of ast node
26685  *
26686  * Every node in the ast has a type defined in ast::AstNodeType and this
26687  * function is used to retrieve the same.
26688  *
26689  * \return ast node type i.e. ast::AstNodeType::RESET
26690  *
26691  * \sa Ast::get_node_type_name
26692  */
26693  AstNodeType get_node_type() const noexcept override {
26694  return AstNodeType::RESET;
26695  }
26696 
26697  /**
26698  * \brief Return type (ast::AstNodeType) of ast node as std::string
26699  *
26700  * Every node in the ast has a type defined in ast::AstNodeType.
26701  * This type name can be returned as a std::string for printing
26702  * node to text/json form.
26703  *
26704  * \return name of the node type as a string i.e. "Reset"
26705  *
26706  * \sa Ast::get_node_name
26707  */
26708  std::string get_node_type_name() const noexcept override { return "Reset"; }
26709 
26710  /**
26711  * \brief Return NMODL statement of ast node as std::string
26712  *
26713  * Every node is related to a special statement in the NMODL. This
26714  * statement can be returned as a std::string for printing to
26715  * text/json form.
26716  *
26717  * \return name of the statement as a string i.e. "RESET"
26718  *
26719  * \sa Ast::get_nmodl_name
26720  */
26721  std::string get_nmodl_name() const noexcept override { return "RESET"; }
26722 
26723  /**
26724  * \brief Get std::shared_ptr from `this` pointer of the current ast node
26725  */
26726  std::shared_ptr<Ast> get_shared_ptr() override {
26727  return std::static_pointer_cast<Reset>(shared_from_this());
26728  }
26729 
26730  /**
26731  * \brief Get std::shared_ptr from `this` pointer of the current ast node
26732  */
26733  std::shared_ptr<const Ast> get_shared_ptr() const override {
26734  return std::static_pointer_cast<const Reset>(shared_from_this());
26735  }
26736 
26737  /**
26738  * \brief Return associated token for the current ast node
26739  *
26740  * Not all ast nodes have token information. For example,
26741  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
26742  * solution of ODEs. In this case, we return nullptr to store in the
26743  * nmodl::symtab::SymbolTable.
26744  *
26745  * \return pointer to token if exist otherwise nullptr
26746  */
26747  const ModToken *get_token() const noexcept override { return token.get(); }
26748 
26749  /// \}
26750 
26751  /// \name Setters
26752  /// \{
26753 
26754  /**
26755  * \brief Set token for the current ast node
26756  */
26757  void set_token(const ModToken &tok) {
26758  token = std::make_shared<ModToken>(tok);
26759  }
26760 
26761  /// \}
26762 
26763  /// \name Visitor
26764  /// \{
26765 
26766  /**
26767  * \brief visit children i.e. member variables of current node using provided
26768  * visitor
26769  *
26770  * Different nodes in the AST have different members (i.e. children). This
26771  * method recursively visits children using provided visitor.
26772  *
26773  * \param v Concrete visitor that will be used to recursively visit children
26774  *
26775  * \sa Ast::visit_children for example.
26776  */
26777  void visit_children(visitor::Visitor &v) override;
26778 
26779  /**
26780  * \brief visit children i.e. member variables of current node using provided
26781  * visitor
26782  *
26783  * Different nodes in the AST have different members (i.e. children). This
26784  * method recursively visits children using provided visitor.
26785  *
26786  * \param v Concrete constant visitor that will be used to recursively visit
26787  * children
26788  *
26789  * \sa Ast::visit_children for example.
26790  */
26791  void visit_children(visitor::ConstVisitor &v) const override;
26792 
26793  /**
26794  * \brief accept (or visit) the current AST node using provided visitor
26795  *
26796  * Instead of visiting children of AST node, like Ast::visit_children,
26797  * accept allows to visit the current node itself using provided concrete
26798  * visitor.
26799  *
26800  * \param v Concrete visitor that will be used to recursively visit node
26801  *
26802  * \sa Ast::accept for example.
26803  */
26804  void accept(visitor::Visitor &v) override;
26805 
26806  /**
26807  * \copydoc accept(visitor::Visitor&)
26808  */
26809  void accept(visitor::ConstVisitor &v) const override;
26810 
26811  /// \}
26812 };
26813 
26814 /** @} */ // end of ast_class
26815 
26816 } // namespace ast
26817 } // namespace nmodl
26818 #endif // !NMODL_AST_RESET_HPP
26819 #ifndef NMODL_AST_SENS_HPP
26820 #define NMODL_AST_SENS_HPP
26821 
26822 namespace nmodl {
26823 namespace ast {
26824 
26825 /**
26826  * @addtogroup ast_class
26827  * @ingroup ast
26828  * @{
26829  */
26830 
26831 /**
26832  * \brief Represent SENS statement in NMODL
26833  *
26834  *
26835  */
26836 class Sens : public Statement {
26837 private:
26838  /// TODO
26840  /// token with location information
26841  std::shared_ptr<ModToken> token;
26842 
26843 public:
26844  /// \name Ctor & dtor
26845  /// \{
26846 
26847  explicit Sens(VarNameVector variables);
26848  Sens(const Sens &obj);
26849 
26850  virtual ~Sens() = default;
26851 
26852  /// \}
26853 
26854  /**
26855  * \brief Check if the ast node is an instance of ast::Sens
26856  * \return true as object is of type ast::Sens
26857  */
26858  bool is_sens() const noexcept override { return true; }
26859 
26860  /**
26861  * \brief Return a copy of the current node
26862  *
26863  * Recursively make a new copy/clone of the current node including
26864  * all members and return a pointer to the node. This is used for
26865  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
26866  * ast.
26867  *
26868  * @return pointer to the clone/copy of the current node
26869  */
26870  Sens *clone() const override { return new Sens(*this); }
26871 
26872  /// \name Getters
26873  /// \{
26874 
26875  /**
26876  * \brief Return type (ast::AstNodeType) of ast node
26877  *
26878  * Every node in the ast has a type defined in ast::AstNodeType and this
26879  * function is used to retrieve the same.
26880  *
26881  * \return ast node type i.e. ast::AstNodeType::SENS
26882  *
26883  * \sa Ast::get_node_type_name
26884  */
26885  AstNodeType get_node_type() const noexcept override {
26886  return AstNodeType::SENS;
26887  }
26888 
26889  /**
26890  * \brief Return type (ast::AstNodeType) of ast node as std::string
26891  *
26892  * Every node in the ast has a type defined in ast::AstNodeType.
26893  * This type name can be returned as a std::string for printing
26894  * node to text/json form.
26895  *
26896  * \return name of the node type as a string i.e. "Sens"
26897  *
26898  * \sa Ast::get_node_name
26899  */
26900  std::string get_node_type_name() const noexcept override { return "Sens"; }
26901 
26902  /**
26903  * \brief Return NMODL statement of ast node as std::string
26904  *
26905  * Every node is related to a special statement in the NMODL. This
26906  * statement can be returned as a std::string for printing to
26907  * text/json form.
26908  *
26909  * \return name of the statement as a string i.e. "SENS "
26910  *
26911  * \sa Ast::get_nmodl_name
26912  */
26913  std::string get_nmodl_name() const noexcept override { return "SENS "; }
26914 
26915  /**
26916  * \brief Get std::shared_ptr from `this` pointer of the current ast node
26917  */
26918  std::shared_ptr<Ast> get_shared_ptr() override {
26919  return std::static_pointer_cast<Sens>(shared_from_this());
26920  }
26921 
26922  /**
26923  * \brief Get std::shared_ptr from `this` pointer of the current ast node
26924  */
26925  std::shared_ptr<const Ast> get_shared_ptr() const override {
26926  return std::static_pointer_cast<const Sens>(shared_from_this());
26927  }
26928 
26929  /**
26930  * \brief Return associated token for the current ast node
26931  *
26932  * Not all ast nodes have token information. For example,
26933  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
26934  * solution of ODEs. In this case, we return nullptr to store in the
26935  * nmodl::symtab::SymbolTable.
26936  *
26937  * \return pointer to token if exist otherwise nullptr
26938  */
26939  const ModToken *get_token() const noexcept override { return token.get(); }
26940 
26941  /**
26942  * \brief Getter for member variable \ref Sens.variables
26943  */
26944  const VarNameVector &get_variables() const noexcept { return variables; }
26945 
26946  /// \}
26947 
26948  /// \name Setters
26949  /// \{
26950 
26951  /**
26952  * \brief Set token for the current ast node
26953  */
26954  void set_token(const ModToken &tok) {
26955  token = std::make_shared<ModToken>(tok);
26956  }
26957 
26958  /**
26959  * \brief Setter for member variable \ref Sens.variables (rvalue reference)
26960  */
26961  void set_variables(VarNameVector &&variables);
26962 
26963  /**
26964  * \brief Setter for member variable \ref Sens.variables
26965  */
26966  void set_variables(const VarNameVector &variables);
26967 
26968  /// \}
26969 
26970  /// \name Visitor
26971  /// \{
26972 
26973  /**
26974  * \brief visit children i.e. member variables of current node using provided
26975  * visitor
26976  *
26977  * Different nodes in the AST have different members (i.e. children). This
26978  * method recursively visits children using provided visitor.
26979  *
26980  * \param v Concrete visitor that will be used to recursively visit children
26981  *
26982  * \sa Ast::visit_children for example.
26983  */
26984  void visit_children(visitor::Visitor &v) override;
26985 
26986  /**
26987  * \brief visit children i.e. member variables of current node using provided
26988  * visitor
26989  *
26990  * Different nodes in the AST have different members (i.e. children). This
26991  * method recursively visits children using provided visitor.
26992  *
26993  * \param v Concrete constant visitor that will be used to recursively visit
26994  * children
26995  *
26996  * \sa Ast::visit_children for example.
26997  */
26998  void visit_children(visitor::ConstVisitor &v) const override;
26999 
27000  /**
27001  * \brief accept (or visit) the current AST node using provided visitor
27002  *
27003  * Instead of visiting children of AST node, like Ast::visit_children,
27004  * accept allows to visit the current node itself using provided concrete
27005  * visitor.
27006  *
27007  * \param v Concrete visitor that will be used to recursively visit node
27008  *
27009  * \sa Ast::accept for example.
27010  */
27011  void accept(visitor::Visitor &v) override;
27012 
27013  /**
27014  * \copydoc accept(visitor::Visitor&)
27015  */
27016  void accept(visitor::ConstVisitor &v) const override;
27017 
27018  /// \}
27019 
27020 private:
27021  /**
27022  * \brief Set this object as parent for all the children
27023  *
27024  * This should be called in every object (with children) constructor
27025  * to set parents. Since it is called only in the constructors it
27026  * should not be virtual to avoid ambiguities (issue #295).
27027  */
27028  void set_parent_in_children();
27029 };
27030 
27031 /** @} */ // end of ast_class
27032 
27033 } // namespace ast
27034 } // namespace nmodl
27035 #endif // !NMODL_AST_SENS_HPP
27036 #ifndef NMODL_AST_CONSERVE_HPP
27037 #define NMODL_AST_CONSERVE_HPP
27038 
27039 namespace nmodl {
27040 namespace ast {
27041 
27042 /**
27043  * @addtogroup ast_class
27044  * @ingroup ast
27045  * @{
27046  */
27047 
27048 /**
27049  * \brief Represent CONSERVE statement in NMODL
27050  *
27051  *
27052  */
27053 class Conserve : public Statement {
27054 private:
27055  /// TODO
27056  std::shared_ptr<Expression> react;
27057  /// TODO
27058  std::shared_ptr<Expression> expr;
27059  /// token with location information
27060  std::shared_ptr<ModToken> token;
27061 
27062 public:
27063  /// \name Ctor & dtor
27064  /// \{
27065 
27066  explicit Conserve(Expression *react, Expression *expr);
27067  explicit Conserve(const std::shared_ptr<Expression> &react,
27068  const std::shared_ptr<Expression> &expr);
27069  Conserve(const Conserve &obj);
27070 
27071  virtual ~Conserve() = default;
27072 
27073  /// \}
27074 
27075  /**
27076  * \brief Check if the ast node is an instance of ast::Conserve
27077  * \return true as object is of type ast::Conserve
27078  */
27079  bool is_conserve() const noexcept override { return true; }
27080 
27081  /**
27082  * \brief Return a copy of the current node
27083  *
27084  * Recursively make a new copy/clone of the current node including
27085  * all members and return a pointer to the node. This is used for
27086  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
27087  * ast.
27088  *
27089  * @return pointer to the clone/copy of the current node
27090  */
27091  Conserve *clone() const override { return new Conserve(*this); }
27092 
27093  /// \name Getters
27094  /// \{
27095 
27096  /**
27097  * \brief Return type (ast::AstNodeType) of ast node
27098  *
27099  * Every node in the ast has a type defined in ast::AstNodeType and this
27100  * function is used to retrieve the same.
27101  *
27102  * \return ast node type i.e. ast::AstNodeType::CONSERVE
27103  *
27104  * \sa Ast::get_node_type_name
27105  */
27106  AstNodeType get_node_type() const noexcept override {
27107  return AstNodeType::CONSERVE;
27108  }
27109 
27110  /**
27111  * \brief Return type (ast::AstNodeType) of ast node as std::string
27112  *
27113  * Every node in the ast has a type defined in ast::AstNodeType.
27114  * This type name can be returned as a std::string for printing
27115  * node to text/json form.
27116  *
27117  * \return name of the node type as a string i.e. "Conserve"
27118  *
27119  * \sa Ast::get_node_name
27120  */
27121  std::string get_node_type_name() const noexcept override {
27122  return "Conserve";
27123  }
27124 
27125  /**
27126  * \brief Return NMODL statement of ast node as std::string
27127  *
27128  * Every node is related to a special statement in the NMODL. This
27129  * statement can be returned as a std::string for printing to
27130  * text/json form.
27131  *
27132  * \return name of the statement as a string i.e. "CONSERVE"
27133  *
27134  * \sa Ast::get_nmodl_name
27135  */
27136  std::string get_nmodl_name() const noexcept override { return "CONSERVE"; }
27137 
27138  /**
27139  * \brief Get std::shared_ptr from `this` pointer of the current ast node
27140  */
27141  std::shared_ptr<Ast> get_shared_ptr() override {
27142  return std::static_pointer_cast<Conserve>(shared_from_this());
27143  }
27144 
27145  /**
27146  * \brief Get std::shared_ptr from `this` pointer of the current ast node
27147  */
27148  std::shared_ptr<const Ast> get_shared_ptr() const override {
27149  return std::static_pointer_cast<const Conserve>(shared_from_this());
27150  }
27151 
27152  /**
27153  * \brief Return associated token for the current ast node
27154  *
27155  * Not all ast nodes have token information. For example,
27156  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
27157  * solution of ODEs. In this case, we return nullptr to store in the
27158  * nmodl::symtab::SymbolTable.
27159  *
27160  * \return pointer to token if exist otherwise nullptr
27161  */
27162  const ModToken *get_token() const noexcept override { return token.get(); }
27163 
27164  /**
27165  * \brief Getter for member variable \ref Conserve.react
27166  */
27167  const std::shared_ptr<Expression> &get_react() const noexcept {
27168  return react;
27169  }
27170 
27171  /**
27172  * \brief Getter for member variable \ref Conserve.expr
27173  */
27174  const std::shared_ptr<Expression> &get_expr() const noexcept { return expr; }
27175 
27176  /// \}
27177 
27178  /// \name Setters
27179  /// \{
27180 
27181  /**
27182  * \brief Set token for the current ast node
27183  */
27184  void set_token(const ModToken &tok) {
27185  token = std::make_shared<ModToken>(tok);
27186  }
27187 
27188  /**
27189  * \brief Setter for member variable \ref Conserve.react (rvalue reference)
27190  */
27191  void set_react(std::shared_ptr<Expression> &&react);
27192 
27193  /**
27194  * \brief Setter for member variable \ref Conserve.react
27195  */
27196  void set_react(const std::shared_ptr<Expression> &react);
27197 
27198  /**
27199  * \brief Setter for member variable \ref Conserve.expr (rvalue reference)
27200  */
27201  void set_expr(std::shared_ptr<Expression> &&expr);
27202 
27203  /**
27204  * \brief Setter for member variable \ref Conserve.expr
27205  */
27206  void set_expr(const std::shared_ptr<Expression> &expr);
27207 
27208  /// \}
27209 
27210  /// \name Visitor
27211  /// \{
27212 
27213  /**
27214  * \brief visit children i.e. member variables of current node using provided
27215  * visitor
27216  *
27217  * Different nodes in the AST have different members (i.e. children). This
27218  * method recursively visits children using provided visitor.
27219  *
27220  * \param v Concrete visitor that will be used to recursively visit children
27221  *
27222  * \sa Ast::visit_children for example.
27223  */
27224  void visit_children(visitor::Visitor &v) override;
27225 
27226  /**
27227  * \brief visit children i.e. member variables of current node using provided
27228  * visitor
27229  *
27230  * Different nodes in the AST have different members (i.e. children). This
27231  * method recursively visits children using provided visitor.
27232  *
27233  * \param v Concrete constant visitor that will be used to recursively visit
27234  * children
27235  *
27236  * \sa Ast::visit_children for example.
27237  */
27238  void visit_children(visitor::ConstVisitor &v) const override;
27239 
27240  /**
27241  * \brief accept (or visit) the current AST node using provided visitor
27242  *
27243  * Instead of visiting children of AST node, like Ast::visit_children,
27244  * accept allows to visit the current node itself using provided concrete
27245  * visitor.
27246  *
27247  * \param v Concrete visitor that will be used to recursively visit node
27248  *
27249  * \sa Ast::accept for example.
27250  */
27251  void accept(visitor::Visitor &v) override;
27252 
27253  /**
27254  * \copydoc accept(visitor::Visitor&)
27255  */
27256  void accept(visitor::ConstVisitor &v) const override;
27257 
27258  /// \}
27259 
27260 private:
27261  /**
27262  * \brief Set this object as parent for all the children
27263  *
27264  * This should be called in every object (with children) constructor
27265  * to set parents. Since it is called only in the constructors it
27266  * should not be virtual to avoid ambiguities (issue #295).
27267  */
27268  void set_parent_in_children();
27269 };
27270 
27271 /** @} */ // end of ast_class
27272 
27273 } // namespace ast
27274 } // namespace nmodl
27275 #endif // !NMODL_AST_CONSERVE_HPP
27276 #ifndef NMODL_AST_COMPARTMENT_HPP
27277 #define NMODL_AST_COMPARTMENT_HPP
27278 
27279 namespace nmodl {
27280 namespace ast {
27281 
27282 /**
27283  * @addtogroup ast_class
27284  * @ingroup ast
27285  * @{
27286  */
27287 
27288 /**
27289  * \brief Represent COMPARTMENT statement in NMODL
27290  *
27291  *
27292  */
27293 class Compartment : public Statement {
27294 private:
27295  /// TODO
27296  std::shared_ptr<Name> name;
27297  /// TODO
27298  std::shared_ptr<Expression> expression;
27299  /// TODO
27301  /// token with location information
27302  std::shared_ptr<ModToken> token;
27303 
27304 public:
27305  /// \name Ctor & dtor
27306  /// \{
27307 
27308  explicit Compartment(Name *name, Expression *expression, NameVector names);
27309  explicit Compartment(const std::shared_ptr<Name> &name,
27310  const std::shared_ptr<Expression> &expression,
27311  const NameVector &names);
27312  Compartment(const Compartment &obj);
27313 
27314  virtual ~Compartment() = default;
27315 
27316  /// \}
27317 
27318  /**
27319  * \brief Check if the ast node is an instance of ast::Compartment
27320  * \return true as object is of type ast::Compartment
27321  */
27322  bool is_compartment() const noexcept override { return true; }
27323 
27324  /**
27325  * \brief Return a copy of the current node
27326  *
27327  * Recursively make a new copy/clone of the current node including
27328  * all members and return a pointer to the node. This is used for
27329  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
27330  * ast.
27331  *
27332  * @return pointer to the clone/copy of the current node
27333  */
27334  Compartment *clone() const override { return new Compartment(*this); }
27335 
27336  /// \name Getters
27337  /// \{
27338 
27339  /**
27340  * \brief Return type (ast::AstNodeType) of ast node
27341  *
27342  * Every node in the ast has a type defined in ast::AstNodeType and this
27343  * function is used to retrieve the same.
27344  *
27345  * \return ast node type i.e. ast::AstNodeType::COMPARTMENT
27346  *
27347  * \sa Ast::get_node_type_name
27348  */
27349  AstNodeType get_node_type() const noexcept override {
27350  return AstNodeType::COMPARTMENT;
27351  }
27352 
27353  /**
27354  * \brief Return type (ast::AstNodeType) of ast node as std::string
27355  *
27356  * Every node in the ast has a type defined in ast::AstNodeType.
27357  * This type name can be returned as a std::string for printing
27358  * node to text/json form.
27359  *
27360  * \return name of the node type as a string i.e. "Compartment"
27361  *
27362  * \sa Ast::get_node_name
27363  */
27364  std::string get_node_type_name() const noexcept override {
27365  return "Compartment";
27366  }
27367 
27368  /**
27369  * \brief Return NMODL statement of ast node as std::string
27370  *
27371  * Every node is related to a special statement in the NMODL. This
27372  * statement can be returned as a std::string for printing to
27373  * text/json form.
27374  *
27375  * \return name of the statement as a string i.e. "COMPARTMENT"
27376  *
27377  * \sa Ast::get_nmodl_name
27378  */
27379  std::string get_nmodl_name() const noexcept override { return "COMPARTMENT"; }
27380 
27381  /**
27382  * \brief Get std::shared_ptr from `this` pointer of the current ast node
27383  */
27384  std::shared_ptr<Ast> get_shared_ptr() override {
27385  return std::static_pointer_cast<Compartment>(shared_from_this());
27386  }
27387 
27388  /**
27389  * \brief Get std::shared_ptr from `this` pointer of the current ast node
27390  */
27391  std::shared_ptr<const Ast> get_shared_ptr() const override {
27392  return std::static_pointer_cast<const Compartment>(shared_from_this());
27393  }
27394 
27395  /**
27396  * \brief Return associated token for the current ast node
27397  *
27398  * Not all ast nodes have token information. For example,
27399  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
27400  * solution of ODEs. In this case, we return nullptr to store in the
27401  * nmodl::symtab::SymbolTable.
27402  *
27403  * \return pointer to token if exist otherwise nullptr
27404  */
27405  const ModToken *get_token() const noexcept override { return token.get(); }
27406 
27407  /**
27408  * \brief Getter for member variable \ref Compartment.name
27409  */
27410  const std::shared_ptr<Name> &get_name() const noexcept { return name; }
27411 
27412  /**
27413  * \brief Getter for member variable \ref Compartment.expression
27414  */
27415  const std::shared_ptr<Expression> &get_expression() const noexcept {
27416  return expression;
27417  }
27418 
27419  /**
27420  * \brief Getter for member variable \ref Compartment.names
27421  */
27422  const NameVector &get_names() const noexcept { return names; }
27423 
27424  /// \}
27425 
27426  /// \name Setters
27427  /// \{
27428 
27429  /**
27430  * \brief Set token for the current ast node
27431  */
27432  void set_token(const ModToken &tok) {
27433  token = std::make_shared<ModToken>(tok);
27434  }
27435 
27436  /**
27437  * \brief Setter for member variable \ref Compartment.name (rvalue reference)
27438  */
27439  void set_name(std::shared_ptr<Name> &&name);
27440 
27441  /**
27442  * \brief Setter for member variable \ref Compartment.name
27443  */
27444  void set_name(const std::shared_ptr<Name> &name);
27445 
27446  /**
27447  * \brief Setter for member variable \ref Compartment.expression (rvalue
27448  * reference)
27449  */
27450  void set_expression(std::shared_ptr<Expression> &&expression);
27451 
27452  /**
27453  * \brief Setter for member variable \ref Compartment.expression
27454  */
27455  void set_expression(const std::shared_ptr<Expression> &expression);
27456 
27457  /**
27458  * \brief Setter for member variable \ref Compartment.names (rvalue reference)
27459  */
27460  void set_names(NameVector &&names);
27461 
27462  /**
27463  * \brief Setter for member variable \ref Compartment.names
27464  */
27465  void set_names(const NameVector &names);
27466 
27467  /// \}
27468 
27469  /// \name Visitor
27470  /// \{
27471 
27472  /**
27473  * \brief visit children i.e. member variables of current node using provided
27474  * visitor
27475  *
27476  * Different nodes in the AST have different members (i.e. children). This
27477  * method recursively visits children using provided visitor.
27478  *
27479  * \param v Concrete visitor that will be used to recursively visit children
27480  *
27481  * \sa Ast::visit_children for example.
27482  */
27483  void visit_children(visitor::Visitor &v) override;
27484 
27485  /**
27486  * \brief visit children i.e. member variables of current node using provided
27487  * visitor
27488  *
27489  * Different nodes in the AST have different members (i.e. children). This
27490  * method recursively visits children using provided visitor.
27491  *
27492  * \param v Concrete constant visitor that will be used to recursively visit
27493  * children
27494  *
27495  * \sa Ast::visit_children for example.
27496  */
27497  void visit_children(visitor::ConstVisitor &v) const override;
27498 
27499  /**
27500  * \brief accept (or visit) the current AST node using provided visitor
27501  *
27502  * Instead of visiting children of AST node, like Ast::visit_children,
27503  * accept allows to visit the current node itself using provided concrete
27504  * visitor.
27505  *
27506  * \param v Concrete visitor that will be used to recursively visit node
27507  *
27508  * \sa Ast::accept for example.
27509  */
27510  void accept(visitor::Visitor &v) override;
27511 
27512  /**
27513  * \copydoc accept(visitor::Visitor&)
27514  */
27515  void accept(visitor::ConstVisitor &v) const override;
27516 
27517  /// \}
27518 
27519 private:
27520  /**
27521  * \brief Set this object as parent for all the children
27522  *
27523  * This should be called in every object (with children) constructor
27524  * to set parents. Since it is called only in the constructors it
27525  * should not be virtual to avoid ambiguities (issue #295).
27526  */
27527  void set_parent_in_children();
27528 };
27529 
27530 /** @} */ // end of ast_class
27531 
27532 } // namespace ast
27533 } // namespace nmodl
27534 #endif // !NMODL_AST_COMPARTMENT_HPP
27535 #ifndef NMODL_AST_LON_DIFUSE_HPP
27536 #define NMODL_AST_LON_DIFUSE_HPP
27537 
27538 namespace nmodl {
27539 namespace ast {
27540 
27541 /**
27542  * @addtogroup ast_class
27543  * @ingroup ast
27544  * @{
27545  */
27546 
27547 /**
27548  * \brief Represent LONGITUDINAL_DIFFUSION statement in NMODL
27549  *
27550  *
27551  */
27552 class LonDifuse : public Statement {
27553 private:
27554  /// TODO
27555  std::shared_ptr<Name> name;
27556  /// TODO
27557  std::shared_ptr<Expression> expression;
27558  /// TODO
27560  /// token with location information
27561  std::shared_ptr<ModToken> token;
27562 
27563 public:
27564  /// \name Ctor & dtor
27565  /// \{
27566 
27567  explicit LonDifuse(Name *name, Expression *expression, NameVector names);
27568  explicit LonDifuse(const std::shared_ptr<Name> &name,
27569  const std::shared_ptr<Expression> &expression,
27570  const NameVector &names);
27571  LonDifuse(const LonDifuse &obj);
27572 
27573  virtual ~LonDifuse() = default;
27574 
27575  /// \}
27576 
27577  /**
27578  * \brief Check if the ast node is an instance of ast::LonDifuse
27579  * \return true as object is of type ast::LonDifuse
27580  */
27581  bool is_lon_difuse() const noexcept override { return true; }
27582 
27583  /**
27584  * \brief Return a copy of the current node
27585  *
27586  * Recursively make a new copy/clone of the current node including
27587  * all members and return a pointer to the node. This is used for
27588  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
27589  * ast.
27590  *
27591  * @return pointer to the clone/copy of the current node
27592  */
27593  LonDifuse *clone() const override { return new LonDifuse(*this); }
27594 
27595  /// \name Getters
27596  /// \{
27597 
27598  /**
27599  * \brief Return type (ast::AstNodeType) of ast node
27600  *
27601  * Every node in the ast has a type defined in ast::AstNodeType and this
27602  * function is used to retrieve the same.
27603  *
27604  * \return ast node type i.e. ast::AstNodeType::LON_DIFUSE
27605  *
27606  * \sa Ast::get_node_type_name
27607  */
27608  AstNodeType get_node_type() const noexcept override {
27609  return AstNodeType::LON_DIFUSE;
27610  }
27611 
27612  /**
27613  * \brief Return type (ast::AstNodeType) of ast node as std::string
27614  *
27615  * Every node in the ast has a type defined in ast::AstNodeType.
27616  * This type name can be returned as a std::string for printing
27617  * node to text/json form.
27618  *
27619  * \return name of the node type as a string i.e. "LonDifuse"
27620  *
27621  * \sa Ast::get_node_name
27622  */
27623  std::string get_node_type_name() const noexcept override {
27624  return "LonDifuse";
27625  }
27626 
27627  /**
27628  * \brief Return NMODL statement of ast node as std::string
27629  *
27630  * Every node is related to a special statement in the NMODL. This
27631  * statement can be returned as a std::string for printing to
27632  * text/json form.
27633  *
27634  * \return name of the statement as a string i.e. "LONGITUDINAL_DIFFUSION"
27635  *
27636  * \sa Ast::get_nmodl_name
27637  */
27638  std::string get_nmodl_name() const noexcept override {
27639  return "LONGITUDINAL_DIFFUSION";
27640  }
27641 
27642  /**
27643  * \brief Get std::shared_ptr from `this` pointer of the current ast node
27644  */
27645  std::shared_ptr<Ast> get_shared_ptr() override {
27646  return std::static_pointer_cast<LonDifuse>(shared_from_this());
27647  }
27648 
27649  /**
27650  * \brief Get std::shared_ptr from `this` pointer of the current ast node
27651  */
27652  std::shared_ptr<const Ast> get_shared_ptr() const override {
27653  return std::static_pointer_cast<const LonDifuse>(shared_from_this());
27654  }
27655 
27656  /**
27657  * \brief Return associated token for the current ast node
27658  *
27659  * Not all ast nodes have token information. For example,
27660  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
27661  * solution of ODEs. In this case, we return nullptr to store in the
27662  * nmodl::symtab::SymbolTable.
27663  *
27664  * \return pointer to token if exist otherwise nullptr
27665  */
27666  const ModToken *get_token() const noexcept override { return token.get(); }
27667 
27668  /**
27669  * \brief Getter for member variable \ref LonDifuse.name
27670  */
27671  const std::shared_ptr<Name> &get_name() const noexcept { return name; }
27672 
27673  /**
27674  * \brief Getter for member variable \ref LonDifuse.expression
27675  */
27676  const std::shared_ptr<Expression> &get_expression() const noexcept {
27677  return expression;
27678  }
27679 
27680  /**
27681  * \brief Getter for member variable \ref LonDifuse.names
27682  */
27683  const NameVector &get_names() const noexcept { return names; }
27684 
27685  /// \}
27686 
27687  /// \name Setters
27688  /// \{
27689 
27690  /**
27691  * \brief Set token for the current ast node
27692  */
27693  void set_token(const ModToken &tok) {
27694  token = std::make_shared<ModToken>(tok);
27695  }
27696 
27697  /**
27698  * \brief Setter for member variable \ref LonDifuse.name (rvalue reference)
27699  */
27700  void set_name(std::shared_ptr<Name> &&name);
27701 
27702  /**
27703  * \brief Setter for member variable \ref LonDifuse.name
27704  */
27705  void set_name(const std::shared_ptr<Name> &name);
27706 
27707  /**
27708  * \brief Setter for member variable \ref LonDifuse.expression (rvalue
27709  * reference)
27710  */
27711  void set_expression(std::shared_ptr<Expression> &&expression);
27712 
27713  /**
27714  * \brief Setter for member variable \ref LonDifuse.expression
27715  */
27716  void set_expression(const std::shared_ptr<Expression> &expression);
27717 
27718  /**
27719  * \brief Setter for member variable \ref LonDifuse.names (rvalue reference)
27720  */
27721  void set_names(NameVector &&names);
27722 
27723  /**
27724  * \brief Setter for member variable \ref LonDifuse.names
27725  */
27726  void set_names(const NameVector &names);
27727 
27728  /// \}
27729 
27730  /// \name Visitor
27731  /// \{
27732 
27733  /**
27734  * \brief visit children i.e. member variables of current node using provided
27735  * visitor
27736  *
27737  * Different nodes in the AST have different members (i.e. children). This
27738  * method recursively visits children using provided visitor.
27739  *
27740  * \param v Concrete visitor that will be used to recursively visit children
27741  *
27742  * \sa Ast::visit_children for example.
27743  */
27744  void visit_children(visitor::Visitor &v) override;
27745 
27746  /**
27747  * \brief visit children i.e. member variables of current node using provided
27748  * visitor
27749  *
27750  * Different nodes in the AST have different members (i.e. children). This
27751  * method recursively visits children using provided visitor.
27752  *
27753  * \param v Concrete constant visitor that will be used to recursively visit
27754  * children
27755  *
27756  * \sa Ast::visit_children for example.
27757  */
27758  void visit_children(visitor::ConstVisitor &v) const override;
27759 
27760  /**
27761  * \brief accept (or visit) the current AST node using provided visitor
27762  *
27763  * Instead of visiting children of AST node, like Ast::visit_children,
27764  * accept allows to visit the current node itself using provided concrete
27765  * visitor.
27766  *
27767  * \param v Concrete visitor that will be used to recursively visit node
27768  *
27769  * \sa Ast::accept for example.
27770  */
27771  void accept(visitor::Visitor &v) override;
27772 
27773  /**
27774  * \copydoc accept(visitor::Visitor&)
27775  */
27776  void accept(visitor::ConstVisitor &v) const override;
27777 
27778  /// \}
27779 
27780 private:
27781  /**
27782  * \brief Set this object as parent for all the children
27783  *
27784  * This should be called in every object (with children) constructor
27785  * to set parents. Since it is called only in the constructors it
27786  * should not be virtual to avoid ambiguities (issue #295).
27787  */
27788  void set_parent_in_children();
27789 };
27790 
27791 /** @} */ // end of ast_class
27792 
27793 } // namespace ast
27794 } // namespace nmodl
27795 #endif // !NMODL_AST_LON_DIFUSE_HPP
27796 #ifndef NMODL_AST_REACTION_STATEMENT_HPP
27797 #define NMODL_AST_REACTION_STATEMENT_HPP
27798 
27799 namespace nmodl {
27800 namespace ast {
27801 
27802 /**
27803  * @addtogroup ast_class
27804  * @ingroup ast
27805  * @{
27806  */
27807 
27808 /**
27809  * \brief TODO
27810  *
27811  *
27812  */
27814 private:
27815  /// TODO
27816  std::shared_ptr<Expression> reaction1;
27817  /// TODO
27819  /// TODO
27820  std::shared_ptr<Expression> reaction2;
27821  /// TODO
27822  std::shared_ptr<Expression> expression1;
27823  /// TODO
27824  std::shared_ptr<Expression> expression2;
27825  /// token with location information
27826  std::shared_ptr<ModToken> token;
27827 
27828 public:
27829  /// \name Ctor & dtor
27830  /// \{
27831 
27832  explicit ReactionStatement(Expression *reaction1, const ReactionOperator &op,
27833  Expression *reaction2, Expression *expression1,
27834  Expression *expression2);
27835  explicit ReactionStatement(const std::shared_ptr<Expression> &reaction1,
27836  const ReactionOperator &op,
27837  const std::shared_ptr<Expression> &reaction2,
27838  const std::shared_ptr<Expression> &expression1,
27839  const std::shared_ptr<Expression> &expression2);
27841 
27842  virtual ~ReactionStatement() = default;
27843 
27844  /// \}
27845 
27846  /**
27847  * \brief Check if the ast node is an instance of ast::ReactionStatement
27848  * \return true as object is of type ast::ReactionStatement
27849  */
27850  bool is_reaction_statement() const noexcept override { return true; }
27851 
27852  /**
27853  * \brief Return a copy of the current node
27854  *
27855  * Recursively make a new copy/clone of the current node including
27856  * all members and return a pointer to the node. This is used for
27857  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
27858  * ast.
27859  *
27860  * @return pointer to the clone/copy of the current node
27861  */
27862  ReactionStatement *clone() const override {
27863  return new ReactionStatement(*this);
27864  }
27865 
27866  /// \name Getters
27867  /// \{
27868 
27869  /**
27870  * \brief Return type (ast::AstNodeType) of ast node
27871  *
27872  * Every node in the ast has a type defined in ast::AstNodeType and this
27873  * function is used to retrieve the same.
27874  *
27875  * \return ast node type i.e. ast::AstNodeType::REACTION_STATEMENT
27876  *
27877  * \sa Ast::get_node_type_name
27878  */
27879  AstNodeType get_node_type() const noexcept override {
27881  }
27882 
27883  /**
27884  * \brief Return type (ast::AstNodeType) of ast node as std::string
27885  *
27886  * Every node in the ast has a type defined in ast::AstNodeType.
27887  * This type name can be returned as a std::string for printing
27888  * node to text/json form.
27889  *
27890  * \return name of the node type as a string i.e. "ReactionStatement"
27891  *
27892  * \sa Ast::get_node_name
27893  */
27894  std::string get_node_type_name() const noexcept override {
27895  return "ReactionStatement";
27896  }
27897 
27898  /**
27899  * \brief Return NMODL statement of ast node as std::string
27900  *
27901  * Every node is related to a special statement in the NMODL. This
27902  * statement can be returned as a std::string for printing to
27903  * text/json form.
27904  *
27905  * \return name of the statement as a string i.e. "~ "
27906  *
27907  * \sa Ast::get_nmodl_name
27908  */
27909  std::string get_nmodl_name() const noexcept override { return "~ "; }
27910 
27911  /**
27912  * \brief Get std::shared_ptr from `this` pointer of the current ast node
27913  */
27914  std::shared_ptr<Ast> get_shared_ptr() override {
27915  return std::static_pointer_cast<ReactionStatement>(shared_from_this());
27916  }
27917 
27918  /**
27919  * \brief Get std::shared_ptr from `this` pointer of the current ast node
27920  */
27921  std::shared_ptr<const Ast> get_shared_ptr() const override {
27922  return std::static_pointer_cast<const ReactionStatement>(
27923  shared_from_this());
27924  }
27925 
27926  /**
27927  * \brief Return associated token for the current ast node
27928  *
27929  * Not all ast nodes have token information. For example,
27930  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
27931  * solution of ODEs. In this case, we return nullptr to store in the
27932  * nmodl::symtab::SymbolTable.
27933  *
27934  * \return pointer to token if exist otherwise nullptr
27935  */
27936  const ModToken *get_token() const noexcept override { return token.get(); }
27937 
27938  /**
27939  * \brief Getter for member variable \ref ReactionStatement.reaction1
27940  */
27941  const std::shared_ptr<Expression> &get_reaction1() const noexcept {
27942  return reaction1;
27943  }
27944 
27945  /**
27946  * \brief Getter for member variable \ref ReactionStatement.op
27947  */
27948  const ReactionOperator &get_op() const noexcept { return op; }
27949 
27950  /**
27951  * \brief Getter for member variable \ref ReactionStatement.reaction2
27952  */
27953  const std::shared_ptr<Expression> &get_reaction2() const noexcept {
27954  return reaction2;
27955  }
27956 
27957  /**
27958  * \brief Getter for member variable \ref ReactionStatement.expression1
27959  */
27960  const std::shared_ptr<Expression> &get_expression1() const noexcept {
27961  return expression1;
27962  }
27963 
27964  /**
27965  * \brief Getter for member variable \ref ReactionStatement.expression2
27966  */
27967  const std::shared_ptr<Expression> &get_expression2() const noexcept {
27968  return expression2;
27969  }
27970 
27971  /// \}
27972 
27973  /// \name Setters
27974  /// \{
27975 
27976  /**
27977  * \brief Set token for the current ast node
27978  */
27979  void set_token(const ModToken &tok) {
27980  token = std::make_shared<ModToken>(tok);
27981  }
27982 
27983  /**
27984  * \brief Setter for member variable \ref ReactionStatement.reaction1 (rvalue
27985  * reference)
27986  */
27987  void set_reaction1(std::shared_ptr<Expression> &&reaction1);
27988 
27989  /**
27990  * \brief Setter for member variable \ref ReactionStatement.reaction1
27991  */
27992  void set_reaction1(const std::shared_ptr<Expression> &reaction1);
27993 
27994  /**
27995  * \brief Setter for member variable \ref ReactionStatement.op (rvalue
27996  * reference)
27997  */
27998  void set_op(ReactionOperator &&op);
27999 
28000  /**
28001  * \brief Setter for member variable \ref ReactionStatement.op
28002  */
28003  void set_op(const ReactionOperator &op);
28004 
28005  /**
28006  * \brief Setter for member variable \ref ReactionStatement.reaction2 (rvalue
28007  * reference)
28008  */
28009  void set_reaction2(std::shared_ptr<Expression> &&reaction2);
28010 
28011  /**
28012  * \brief Setter for member variable \ref ReactionStatement.reaction2
28013  */
28014  void set_reaction2(const std::shared_ptr<Expression> &reaction2);
28015 
28016  /**
28017  * \brief Setter for member variable \ref ReactionStatement.expression1
28018  * (rvalue reference)
28019  */
28020  void set_expression1(std::shared_ptr<Expression> &&expression1);
28021 
28022  /**
28023  * \brief Setter for member variable \ref ReactionStatement.expression1
28024  */
28025  void set_expression1(const std::shared_ptr<Expression> &expression1);
28026 
28027  /**
28028  * \brief Setter for member variable \ref ReactionStatement.expression2
28029  * (rvalue reference)
28030  */
28031  void set_expression2(std::shared_ptr<Expression> &&expression2);
28032 
28033  /**
28034  * \brief Setter for member variable \ref ReactionStatement.expression2
28035  */
28036  void set_expression2(const std::shared_ptr<Expression> &expression2);
28037 
28038  /// \}
28039 
28040  /// \name Visitor
28041  /// \{
28042 
28043  /**
28044  * \brief visit children i.e. member variables of current node using provided
28045  * visitor
28046  *
28047  * Different nodes in the AST have different members (i.e. children). This
28048  * method recursively visits children using provided visitor.
28049  *
28050  * \param v Concrete visitor that will be used to recursively visit children
28051  *
28052  * \sa Ast::visit_children for example.
28053  */
28054  void visit_children(visitor::Visitor &v) override;
28055 
28056  /**
28057  * \brief visit children i.e. member variables of current node using provided
28058  * visitor
28059  *
28060  * Different nodes in the AST have different members (i.e. children). This
28061  * method recursively visits children using provided visitor.
28062  *
28063  * \param v Concrete constant visitor that will be used to recursively visit
28064  * children
28065  *
28066  * \sa Ast::visit_children for example.
28067  */
28068  void visit_children(visitor::ConstVisitor &v) const override;
28069 
28070  /**
28071  * \brief accept (or visit) the current AST node using provided visitor
28072  *
28073  * Instead of visiting children of AST node, like Ast::visit_children,
28074  * accept allows to visit the current node itself using provided concrete
28075  * visitor.
28076  *
28077  * \param v Concrete visitor that will be used to recursively visit node
28078  *
28079  * \sa Ast::accept for example.
28080  */
28081  void accept(visitor::Visitor &v) override;
28082 
28083  /**
28084  * \copydoc accept(visitor::Visitor&)
28085  */
28086  void accept(visitor::ConstVisitor &v) const override;
28087 
28088  /// \}
28089 
28090 private:
28091  /**
28092  * \brief Set this object as parent for all the children
28093  *
28094  * This should be called in every object (with children) constructor
28095  * to set parents. Since it is called only in the constructors it
28096  * should not be virtual to avoid ambiguities (issue #295).
28097  */
28098  void set_parent_in_children();
28099 };
28100 
28101 /** @} */ // end of ast_class
28102 
28103 } // namespace ast
28104 } // namespace nmodl
28105 #endif // !NMODL_AST_REACTION_STATEMENT_HPP
28106 #ifndef NMODL_AST_LAG_STATEMENT_HPP
28107 #define NMODL_AST_LAG_STATEMENT_HPP
28108 
28109 namespace nmodl {
28110 namespace ast {
28111 
28112 /**
28113  * @addtogroup ast_class
28114  * @ingroup ast
28115  * @{
28116  */
28117 
28118 /**
28119  * \brief Represents a LAG statement in the mod file
28120  *
28121  * An example of LAG statement usage:
28122  *
28123  * \code{.mod}
28124  * PROCEDURE lates() {
28125  * LAG ina BY tau
28126  * neo = lag_ina_tau
28127  * if (ena < 70) {ena = 70}
28128  * }
28129  * \endcode
28130  *
28131  */
28132 class LagStatement : public Statement {
28133 private:
28134  /// Name of the variable (TODO)
28135  std::shared_ptr<Identifier> name;
28136  /// Name of the variable (TODO)
28137  std::shared_ptr<Name> byname;
28138  /// token with location information
28139  std::shared_ptr<ModToken> token;
28140 
28141 public:
28142  /// \name Ctor & dtor
28143  /// \{
28144 
28145  explicit LagStatement(Identifier *name, Name *byname);
28146  explicit LagStatement(const std::shared_ptr<Identifier> &name,
28147  const std::shared_ptr<Name> &byname);
28148  LagStatement(const LagStatement &obj);
28149 
28150  virtual ~LagStatement() = default;
28151 
28152  /// \}
28153 
28154  /**
28155  * \brief Check if the ast node is an instance of ast::LagStatement
28156  * \return true as object is of type ast::LagStatement
28157  */
28158  bool is_lag_statement() const noexcept override { return true; }
28159 
28160  /**
28161  * \brief Return a copy of the current node
28162  *
28163  * Recursively make a new copy/clone of the current node including
28164  * all members and return a pointer to the node. This is used for
28165  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
28166  * ast.
28167  *
28168  * @return pointer to the clone/copy of the current node
28169  */
28170  LagStatement *clone() const override { return new LagStatement(*this); }
28171 
28172  /// \name Getters
28173  /// \{
28174 
28175  /**
28176  * \brief Return type (ast::AstNodeType) of ast node
28177  *
28178  * Every node in the ast has a type defined in ast::AstNodeType and this
28179  * function is used to retrieve the same.
28180  *
28181  * \return ast node type i.e. ast::AstNodeType::LAG_STATEMENT
28182  *
28183  * \sa Ast::get_node_type_name
28184  */
28185  AstNodeType get_node_type() const noexcept override {
28187  }
28188 
28189  /**
28190  * \brief Return type (ast::AstNodeType) of ast node as std::string
28191  *
28192  * Every node in the ast has a type defined in ast::AstNodeType.
28193  * This type name can be returned as a std::string for printing
28194  * node to text/json form.
28195  *
28196  * \return name of the node type as a string i.e. "LagStatement"
28197  *
28198  * \sa Ast::get_node_name
28199  */
28200  std::string get_node_type_name() const noexcept override {
28201  return "LagStatement";
28202  }
28203 
28204  /**
28205  * \brief Return NMODL statement of ast node as std::string
28206  *
28207  * Every node is related to a special statement in the NMODL. This
28208  * statement can be returned as a std::string for printing to
28209  * text/json form.
28210  *
28211  * \return name of the statement as a string i.e. "LAG "
28212  *
28213  * \sa Ast::get_nmodl_name
28214  */
28215  std::string get_nmodl_name() const noexcept override { return "LAG "; }
28216 
28217  /**
28218  * \brief Get std::shared_ptr from `this` pointer of the current ast node
28219  */
28220  std::shared_ptr<Ast> get_shared_ptr() override {
28221  return std::static_pointer_cast<LagStatement>(shared_from_this());
28222  }
28223 
28224  /**
28225  * \brief Get std::shared_ptr from `this` pointer of the current ast node
28226  */
28227  std::shared_ptr<const Ast> get_shared_ptr() const override {
28228  return std::static_pointer_cast<const LagStatement>(shared_from_this());
28229  }
28230 
28231  /**
28232  * \brief Return associated token for the current ast node
28233  *
28234  * Not all ast nodes have token information. For example,
28235  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
28236  * solution of ODEs. In this case, we return nullptr to store in the
28237  * nmodl::symtab::SymbolTable.
28238  *
28239  * \return pointer to token if exist otherwise nullptr
28240  */
28241  const ModToken *get_token() const noexcept override { return token.get(); }
28242 
28243  /**
28244  * \brief Getter for member variable \ref LagStatement.name
28245  */
28246  const std::shared_ptr<Identifier> &get_name() const noexcept { return name; }
28247 
28248  /**
28249  * \brief Getter for member variable \ref LagStatement.byname
28250  */
28251  const std::shared_ptr<Name> &get_byname() const noexcept { return byname; }
28252 
28253  /// \}
28254 
28255  /// \name Setters
28256  /// \{
28257 
28258  /**
28259  * \brief Set token for the current ast node
28260  */
28261  void set_token(const ModToken &tok) {
28262  token = std::make_shared<ModToken>(tok);
28263  }
28264 
28265  /**
28266  * \brief Setter for member variable \ref LagStatement.name (rvalue reference)
28267  */
28268  void set_name(std::shared_ptr<Identifier> &&name);
28269 
28270  /**
28271  * \brief Setter for member variable \ref LagStatement.name
28272  */
28273  void set_name(const std::shared_ptr<Identifier> &name);
28274 
28275  /**
28276  * \brief Setter for member variable \ref LagStatement.byname (rvalue
28277  * reference)
28278  */
28279  void set_byname(std::shared_ptr<Name> &&byname);
28280 
28281  /**
28282  * \brief Setter for member variable \ref LagStatement.byname
28283  */
28284  void set_byname(const std::shared_ptr<Name> &byname);
28285 
28286  /// \}
28287 
28288  /// \name Visitor
28289  /// \{
28290 
28291  /**
28292  * \brief visit children i.e. member variables of current node using provided
28293  * visitor
28294  *
28295  * Different nodes in the AST have different members (i.e. children). This
28296  * method recursively visits children using provided visitor.
28297  *
28298  * \param v Concrete visitor that will be used to recursively visit children
28299  *
28300  * \sa Ast::visit_children for example.
28301  */
28302  void visit_children(visitor::Visitor &v) override;
28303 
28304  /**
28305  * \brief visit children i.e. member variables of current node using provided
28306  * visitor
28307  *
28308  * Different nodes in the AST have different members (i.e. children). This
28309  * method recursively visits children using provided visitor.
28310  *
28311  * \param v Concrete constant visitor that will be used to recursively visit
28312  * children
28313  *
28314  * \sa Ast::visit_children for example.
28315  */
28316  void visit_children(visitor::ConstVisitor &v) const override;
28317 
28318  /**
28319  * \brief accept (or visit) the current AST node using provided visitor
28320  *
28321  * Instead of visiting children of AST node, like Ast::visit_children,
28322  * accept allows to visit the current node itself using provided concrete
28323  * visitor.
28324  *
28325  * \param v Concrete visitor that will be used to recursively visit node
28326  *
28327  * \sa Ast::accept for example.
28328  */
28329  void accept(visitor::Visitor &v) override;
28330 
28331  /**
28332  * \copydoc accept(visitor::Visitor&)
28333  */
28334  void accept(visitor::ConstVisitor &v) const override;
28335 
28336  /// \}
28337 
28338 private:
28339  /**
28340  * \brief Set this object as parent for all the children
28341  *
28342  * This should be called in every object (with children) constructor
28343  * to set parents. Since it is called only in the constructors it
28344  * should not be virtual to avoid ambiguities (issue #295).
28345  */
28346  void set_parent_in_children();
28347 };
28348 
28349 /** @} */ // end of ast_class
28350 
28351 } // namespace ast
28352 } // namespace nmodl
28353 #endif // !NMODL_AST_LAG_STATEMENT_HPP
28354 #ifndef NMODL_AST_QUEUE_STATEMENT_HPP
28355 #define NMODL_AST_QUEUE_STATEMENT_HPP
28356 
28357 namespace nmodl {
28358 namespace ast {
28359 
28360 /**
28361  * @addtogroup ast_class
28362  * @ingroup ast
28363  * @{
28364  */
28365 
28366 /**
28367  * \brief Represent queue statement in NMODL
28368  *
28369  *
28370  */
28371 class QueueStatement : public Statement {
28372 private:
28373  /// queue type (put/get)
28374  std::shared_ptr<QueueExpressionType> qtype;
28375  /// Name of the variable
28376  std::shared_ptr<Identifier> name;
28377  /// token with location information
28378  std::shared_ptr<ModToken> token;
28379 
28380 public:
28381  /// \name Ctor & dtor
28382  /// \{
28383 
28384  explicit QueueStatement(QueueExpressionType *qtype, Identifier *name);
28385  explicit QueueStatement(const std::shared_ptr<QueueExpressionType> &qtype,
28386  const std::shared_ptr<Identifier> &name);
28387  QueueStatement(const QueueStatement &obj);
28388 
28389  virtual ~QueueStatement() = default;
28390 
28391  /// \}
28392 
28393  /**
28394  * \brief Check if the ast node is an instance of ast::QueueStatement
28395  * \return true as object is of type ast::QueueStatement
28396  */
28397  bool is_queue_statement() const noexcept override { return true; }
28398 
28399  /**
28400  * \brief Return a copy of the current node
28401  *
28402  * Recursively make a new copy/clone of the current node including
28403  * all members and return a pointer to the node. This is used for
28404  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
28405  * ast.
28406  *
28407  * @return pointer to the clone/copy of the current node
28408  */
28409  QueueStatement *clone() const override { return new QueueStatement(*this); }
28410 
28411  /// \name Getters
28412  /// \{
28413 
28414  /**
28415  * \brief Return type (ast::AstNodeType) of ast node
28416  *
28417  * Every node in the ast has a type defined in ast::AstNodeType and this
28418  * function is used to retrieve the same.
28419  *
28420  * \return ast node type i.e. ast::AstNodeType::QUEUE_STATEMENT
28421  *
28422  * \sa Ast::get_node_type_name
28423  */
28424  AstNodeType get_node_type() const noexcept override {
28426  }
28427 
28428  /**
28429  * \brief Return type (ast::AstNodeType) of ast node as std::string
28430  *
28431  * Every node in the ast has a type defined in ast::AstNodeType.
28432  * This type name can be returned as a std::string for printing
28433  * node to text/json form.
28434  *
28435  * \return name of the node type as a string i.e. "QueueStatement"
28436  *
28437  * \sa Ast::get_node_name
28438  */
28439  std::string get_node_type_name() const noexcept override {
28440  return "QueueStatement";
28441  }
28442 
28443  /**
28444  * \brief Get std::shared_ptr from `this` pointer of the current ast node
28445  */
28446  std::shared_ptr<Ast> get_shared_ptr() override {
28447  return std::static_pointer_cast<QueueStatement>(shared_from_this());
28448  }
28449 
28450  /**
28451  * \brief Get std::shared_ptr from `this` pointer of the current ast node
28452  */
28453  std::shared_ptr<const Ast> get_shared_ptr() const override {
28454  return std::static_pointer_cast<const QueueStatement>(shared_from_this());
28455  }
28456 
28457  /**
28458  * \brief Return associated token for the current ast node
28459  *
28460  * Not all ast nodes have token information. For example,
28461  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
28462  * solution of ODEs. In this case, we return nullptr to store in the
28463  * nmodl::symtab::SymbolTable.
28464  *
28465  * \return pointer to token if exist otherwise nullptr
28466  */
28467  const ModToken *get_token() const noexcept override { return token.get(); }
28468 
28469  /**
28470  * \brief Getter for member variable \ref QueueStatement.qtype
28471  */
28472  const std::shared_ptr<QueueExpressionType> &get_qtype() const noexcept {
28473  return qtype;
28474  }
28475 
28476  /**
28477  * \brief Getter for member variable \ref QueueStatement.name
28478  */
28479  const std::shared_ptr<Identifier> &get_name() const noexcept { return name; }
28480 
28481  /// \}
28482 
28483  /// \name Setters
28484  /// \{
28485 
28486  /**
28487  * \brief Set token for the current ast node
28488  */
28489  void set_token(const ModToken &tok) {
28490  token = std::make_shared<ModToken>(tok);
28491  }
28492 
28493  /**
28494  * \brief Setter for member variable \ref QueueStatement.qtype (rvalue
28495  * reference)
28496  */
28497  void set_qtype(std::shared_ptr<QueueExpressionType> &&qtype);
28498 
28499  /**
28500  * \brief Setter for member variable \ref QueueStatement.qtype
28501  */
28502  void set_qtype(const std::shared_ptr<QueueExpressionType> &qtype);
28503 
28504  /**
28505  * \brief Setter for member variable \ref QueueStatement.name (rvalue
28506  * reference)
28507  */
28508  void set_name(std::shared_ptr<Identifier> &&name);
28509 
28510  /**
28511  * \brief Setter for member variable \ref QueueStatement.name
28512  */
28513  void set_name(const std::shared_ptr<Identifier> &name);
28514 
28515  /// \}
28516 
28517  /// \name Visitor
28518  /// \{
28519 
28520  /**
28521  * \brief visit children i.e. member variables of current node using provided
28522  * visitor
28523  *
28524  * Different nodes in the AST have different members (i.e. children). This
28525  * method recursively visits children using provided visitor.
28526  *
28527  * \param v Concrete visitor that will be used to recursively visit children
28528  *
28529  * \sa Ast::visit_children for example.
28530  */
28531  void visit_children(visitor::Visitor &v) override;
28532 
28533  /**
28534  * \brief visit children i.e. member variables of current node using provided
28535  * visitor
28536  *
28537  * Different nodes in the AST have different members (i.e. children). This
28538  * method recursively visits children using provided visitor.
28539  *
28540  * \param v Concrete constant visitor that will be used to recursively visit
28541  * children
28542  *
28543  * \sa Ast::visit_children for example.
28544  */
28545  void visit_children(visitor::ConstVisitor &v) const override;
28546 
28547  /**
28548  * \brief accept (or visit) the current AST node using provided visitor
28549  *
28550  * Instead of visiting children of AST node, like Ast::visit_children,
28551  * accept allows to visit the current node itself using provided concrete
28552  * visitor.
28553  *
28554  * \param v Concrete visitor that will be used to recursively visit node
28555  *
28556  * \sa Ast::accept for example.
28557  */
28558  void accept(visitor::Visitor &v) override;
28559 
28560  /**
28561  * \copydoc accept(visitor::Visitor&)
28562  */
28563  void accept(visitor::ConstVisitor &v) const override;
28564 
28565  /// \}
28566 
28567 private:
28568  /**
28569  * \brief Set this object as parent for all the children
28570  *
28571  * This should be called in every object (with children) constructor
28572  * to set parents. Since it is called only in the constructors it
28573  * should not be virtual to avoid ambiguities (issue #295).
28574  */
28575  void set_parent_in_children();
28576 };
28577 
28578 /** @} */ // end of ast_class
28579 
28580 } // namespace ast
28581 } // namespace nmodl
28582 #endif // !NMODL_AST_QUEUE_STATEMENT_HPP
28583 #ifndef NMODL_AST_CONSTANT_STATEMENT_HPP
28584 #define NMODL_AST_CONSTANT_STATEMENT_HPP
28585 
28586 namespace nmodl {
28587 namespace ast {
28588 
28589 /**
28590  * @addtogroup ast_class
28591  * @ingroup ast
28592  * @{
28593  */
28594 
28595 /**
28596  * \brief Represent statement in CONSTANT block of NMODL
28597  *
28598  * \todo As ConstantStatement wraps a single ConstantVar,
28599  * this or ast::ConstantVar can be redundant in the future.
28600  *
28601  */
28603 private:
28604  /// single constant variable
28605  std::shared_ptr<ConstantVar> constant;
28606  /// token with location information
28607  std::shared_ptr<ModToken> token;
28608 
28609 public:
28610  /// \name Ctor & dtor
28611  /// \{
28612 
28613  explicit ConstantStatement(ConstantVar *constant);
28614  explicit ConstantStatement(const std::shared_ptr<ConstantVar> &constant);
28616 
28617  virtual ~ConstantStatement() = default;
28618 
28619  /// \}
28620 
28621  /**
28622  * \brief Check if the ast node is an instance of ast::ConstantStatement
28623  * \return true as object is of type ast::ConstantStatement
28624  */
28625  bool is_constant_statement() const noexcept override { return true; }
28626 
28627  /**
28628  * \brief Return a copy of the current node
28629  *
28630  * Recursively make a new copy/clone of the current node including
28631  * all members and return a pointer to the node. This is used for
28632  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
28633  * ast.
28634  *
28635  * @return pointer to the clone/copy of the current node
28636  */
28637  ConstantStatement *clone() const override {
28638  return new ConstantStatement(*this);
28639  }
28640 
28641  /// \name Getters
28642  /// \{
28643 
28644  /**
28645  * \brief Return type (ast::AstNodeType) of ast node
28646  *
28647  * Every node in the ast has a type defined in ast::AstNodeType and this
28648  * function is used to retrieve the same.
28649  *
28650  * \return ast node type i.e. ast::AstNodeType::CONSTANT_STATEMENT
28651  *
28652  * \sa Ast::get_node_type_name
28653  */
28654  AstNodeType get_node_type() const noexcept override {
28656  }
28657 
28658  /**
28659  * \brief Return type (ast::AstNodeType) of ast node as std::string
28660  *
28661  * Every node in the ast has a type defined in ast::AstNodeType.
28662  * This type name can be returned as a std::string for printing
28663  * node to text/json form.
28664  *
28665  * \return name of the node type as a string i.e. "ConstantStatement"
28666  *
28667  * \sa Ast::get_node_name
28668  */
28669  std::string get_node_type_name() const noexcept override {
28670  return "ConstantStatement";
28671  }
28672 
28673  /**
28674  * \brief Get std::shared_ptr from `this` pointer of the current ast node
28675  */
28676  std::shared_ptr<Ast> get_shared_ptr() override {
28677  return std::static_pointer_cast<ConstantStatement>(shared_from_this());
28678  }
28679 
28680  /**
28681  * \brief Get std::shared_ptr from `this` pointer of the current ast node
28682  */
28683  std::shared_ptr<const Ast> get_shared_ptr() const override {
28684  return std::static_pointer_cast<const ConstantStatement>(
28685  shared_from_this());
28686  }
28687 
28688  /**
28689  * \brief Return associated token for the current ast node
28690  *
28691  * Not all ast nodes have token information. For example,
28692  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
28693  * solution of ODEs. In this case, we return nullptr to store in the
28694  * nmodl::symtab::SymbolTable.
28695  *
28696  * \return pointer to token if exist otherwise nullptr
28697  */
28698  const ModToken *get_token() const noexcept override { return token.get(); }
28699 
28700  /**
28701  * \brief Getter for member variable \ref ConstantStatement.constant
28702  */
28703  const std::shared_ptr<ConstantVar> &get_constant() const noexcept {
28704  return constant;
28705  }
28706 
28707  /// \}
28708 
28709  /// \name Setters
28710  /// \{
28711 
28712  /**
28713  * \brief Set token for the current ast node
28714  */
28715  void set_token(const ModToken &tok) {
28716  token = std::make_shared<ModToken>(tok);
28717  }
28718 
28719  /**
28720  * \brief Setter for member variable \ref ConstantStatement.constant (rvalue
28721  * reference)
28722  */
28723  void set_constant(std::shared_ptr<ConstantVar> &&constant);
28724 
28725  /**
28726  * \brief Setter for member variable \ref ConstantStatement.constant
28727  */
28728  void set_constant(const std::shared_ptr<ConstantVar> &constant);
28729 
28730  /// \}
28731 
28732  /// \name Visitor
28733  /// \{
28734 
28735  /**
28736  * \brief visit children i.e. member variables of current node using provided
28737  * visitor
28738  *
28739  * Different nodes in the AST have different members (i.e. children). This
28740  * method recursively visits children using provided visitor.
28741  *
28742  * \param v Concrete visitor that will be used to recursively visit children
28743  *
28744  * \sa Ast::visit_children for example.
28745  */
28746  void visit_children(visitor::Visitor &v) override;
28747 
28748  /**
28749  * \brief visit children i.e. member variables of current node using provided
28750  * visitor
28751  *
28752  * Different nodes in the AST have different members (i.e. children). This
28753  * method recursively visits children using provided visitor.
28754  *
28755  * \param v Concrete constant visitor that will be used to recursively visit
28756  * children
28757  *
28758  * \sa Ast::visit_children for example.
28759  */
28760  void visit_children(visitor::ConstVisitor &v) const override;
28761 
28762  /**
28763  * \brief accept (or visit) the current AST node using provided visitor
28764  *
28765  * Instead of visiting children of AST node, like Ast::visit_children,
28766  * accept allows to visit the current node itself using provided concrete
28767  * visitor.
28768  *
28769  * \param v Concrete visitor that will be used to recursively visit node
28770  *
28771  * \sa Ast::accept for example.
28772  */
28773  void accept(visitor::Visitor &v) override;
28774 
28775  /**
28776  * \copydoc accept(visitor::Visitor&)
28777  */
28778  void accept(visitor::ConstVisitor &v) const override;
28779 
28780  /// \}
28781 
28782 private:
28783  /**
28784  * \brief Set this object as parent for all the children
28785  *
28786  * This should be called in every object (with children) constructor
28787  * to set parents. Since it is called only in the constructors it
28788  * should not be virtual to avoid ambiguities (issue #295).
28789  */
28790  void set_parent_in_children();
28791 };
28792 
28793 /** @} */ // end of ast_class
28794 
28795 } // namespace ast
28796 } // namespace nmodl
28797 #endif // !NMODL_AST_CONSTANT_STATEMENT_HPP
28798 #ifndef NMODL_AST_TABLE_STATEMENT_HPP
28799 #define NMODL_AST_TABLE_STATEMENT_HPP
28800 
28801 namespace nmodl {
28802 namespace ast {
28803 
28804 /**
28805  * @addtogroup ast_class
28806  * @ingroup ast
28807  * @{
28808  */
28809 
28810 /**
28811  * \brief Represents TABLE statement in NMODL
28812  *
28813  *
28814  */
28815 class TableStatement : public Statement {
28816 private:
28817  /// Variables in the table
28819  /// dependent variables
28821  /// from value
28822  std::shared_ptr<Expression> from;
28823  /// to values
28824  std::shared_ptr<Expression> to;
28825  /// an increment factor
28826  std::shared_ptr<Integer> with;
28827  /// token with location information
28828  std::shared_ptr<ModToken> token;
28829 
28830 public:
28831  /// \name Ctor & dtor
28832  /// \{
28833 
28834  explicit TableStatement(NameVector table_vars, NameVector depend_vars,
28835  Expression *from, Expression *to, Integer *with);
28836  explicit TableStatement(const NameVector &table_vars,
28837  const NameVector &depend_vars,
28838  const std::shared_ptr<Expression> &from,
28839  const std::shared_ptr<Expression> &to,
28840  const std::shared_ptr<Integer> &with);
28841  TableStatement(const TableStatement &obj);
28842 
28843  virtual ~TableStatement() = default;
28844 
28845  /// \}
28846 
28847  /**
28848  * \brief Check if the ast node is an instance of ast::TableStatement
28849  * \return true as object is of type ast::TableStatement
28850  */
28851  bool is_table_statement() const noexcept override { return true; }
28852 
28853  /**
28854  * \brief Return a copy of the current node
28855  *
28856  * Recursively make a new copy/clone of the current node including
28857  * all members and return a pointer to the node. This is used for
28858  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
28859  * ast.
28860  *
28861  * @return pointer to the clone/copy of the current node
28862  */
28863  TableStatement *clone() const override { return new TableStatement(*this); }
28864 
28865  /// \name Getters
28866  /// \{
28867 
28868  /**
28869  * \brief Return type (ast::AstNodeType) of ast node
28870  *
28871  * Every node in the ast has a type defined in ast::AstNodeType and this
28872  * function is used to retrieve the same.
28873  *
28874  * \return ast node type i.e. ast::AstNodeType::TABLE_STATEMENT
28875  *
28876  * \sa Ast::get_node_type_name
28877  */
28878  AstNodeType get_node_type() const noexcept override {
28880  }
28881 
28882  /**
28883  * \brief Return type (ast::AstNodeType) of ast node as std::string
28884  *
28885  * Every node in the ast has a type defined in ast::AstNodeType.
28886  * This type name can be returned as a std::string for printing
28887  * node to text/json form.
28888  *
28889  * \return name of the node type as a string i.e. "TableStatement"
28890  *
28891  * \sa Ast::get_node_name
28892  */
28893  std::string get_node_type_name() const noexcept override {
28894  return "TableStatement";
28895  }
28896 
28897  /**
28898  * \brief Return NMODL statement of ast node as std::string
28899  *
28900  * Every node is related to a special statement in the NMODL. This
28901  * statement can be returned as a std::string for printing to
28902  * text/json form.
28903  *
28904  * \return name of the statement as a string i.e. "TABLE "
28905  *
28906  * \sa Ast::get_nmodl_name
28907  */
28908  std::string get_nmodl_name() const noexcept override { return "TABLE "; }
28909 
28910  /**
28911  * \brief Get std::shared_ptr from `this` pointer of the current ast node
28912  */
28913  std::shared_ptr<Ast> get_shared_ptr() override {
28914  return std::static_pointer_cast<TableStatement>(shared_from_this());
28915  }
28916 
28917  /**
28918  * \brief Get std::shared_ptr from `this` pointer of the current ast node
28919  */
28920  std::shared_ptr<const Ast> get_shared_ptr() const override {
28921  return std::static_pointer_cast<const TableStatement>(shared_from_this());
28922  }
28923 
28924  /**
28925  * \brief Return associated token for the current ast node
28926  *
28927  * Not all ast nodes have token information. For example,
28928  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
28929  * solution of ODEs. In this case, we return nullptr to store in the
28930  * nmodl::symtab::SymbolTable.
28931  *
28932  * \return pointer to token if exist otherwise nullptr
28933  */
28934  const ModToken *get_token() const noexcept override { return token.get(); }
28935 
28936  /**
28937  * \brief Getter for member variable \ref TableStatement.table_vars
28938  */
28939  const NameVector &get_table_vars() const noexcept { return table_vars; }
28940 
28941  /**
28942  * \brief Getter for member variable \ref TableStatement.depend_vars
28943  */
28944  const NameVector &get_depend_vars() const noexcept { return depend_vars; }
28945 
28946  /**
28947  * \brief Getter for member variable \ref TableStatement.from
28948  */
28949  const std::shared_ptr<Expression> &get_from() const noexcept { return from; }
28950 
28951  /**
28952  * \brief Getter for member variable \ref TableStatement.to
28953  */
28954  const std::shared_ptr<Expression> &get_to() const noexcept { return to; }
28955 
28956  /**
28957  * \brief Getter for member variable \ref TableStatement.with
28958  */
28959  const std::shared_ptr<Integer> &get_with() const noexcept { return with; }
28960 
28961  /// \}
28962 
28963  /// \name Setters
28964  /// \{
28965 
28966  /**
28967  * \brief Set token for the current ast node
28968  */
28969  void set_token(const ModToken &tok) {
28970  token = std::make_shared<ModToken>(tok);
28971  }
28972 
28973  /**
28974  * \brief Setter for member variable \ref TableStatement.table_vars (rvalue
28975  * reference)
28976  */
28977  void set_table_vars(NameVector &&table_vars);
28978 
28979  /**
28980  * \brief Setter for member variable \ref TableStatement.table_vars
28981  */
28982  void set_table_vars(const NameVector &table_vars);
28983 
28984  /**
28985  * \brief Setter for member variable \ref TableStatement.depend_vars (rvalue
28986  * reference)
28987  */
28988  void set_depend_vars(NameVector &&depend_vars);
28989 
28990  /**
28991  * \brief Setter for member variable \ref TableStatement.depend_vars
28992  */
28993  void set_depend_vars(const NameVector &depend_vars);
28994 
28995  /**
28996  * \brief Setter for member variable \ref TableStatement.from (rvalue
28997  * reference)
28998  */
28999  void set_from(std::shared_ptr<Expression> &&from);
29000 
29001  /**
29002  * \brief Setter for member variable \ref TableStatement.from
29003  */
29004  void set_from(const std::shared_ptr<Expression> &from);
29005 
29006  /**
29007  * \brief Setter for member variable \ref TableStatement.to (rvalue reference)
29008  */
29009  void set_to(std::shared_ptr<Expression> &&to);
29010 
29011  /**
29012  * \brief Setter for member variable \ref TableStatement.to
29013  */
29014  void set_to(const std::shared_ptr<Expression> &to);
29015 
29016  /**
29017  * \brief Setter for member variable \ref TableStatement.with (rvalue
29018  * reference)
29019  */
29020  void set_with(std::shared_ptr<Integer> &&with);
29021 
29022  /**
29023  * \brief Setter for member variable \ref TableStatement.with
29024  */
29025  void set_with(const std::shared_ptr<Integer> &with);
29026 
29027  /// \}
29028 
29029  /// \name Visitor
29030  /// \{
29031 
29032  /**
29033  * \brief visit children i.e. member variables of current node using provided
29034  * visitor
29035  *
29036  * Different nodes in the AST have different members (i.e. children). This
29037  * method recursively visits children using provided visitor.
29038  *
29039  * \param v Concrete visitor that will be used to recursively visit children
29040  *
29041  * \sa Ast::visit_children for example.
29042  */
29043  void visit_children(visitor::Visitor &v) override;
29044 
29045  /**
29046  * \brief visit children i.e. member variables of current node using provided
29047  * visitor
29048  *
29049  * Different nodes in the AST have different members (i.e. children). This
29050  * method recursively visits children using provided visitor.
29051  *
29052  * \param v Concrete constant visitor that will be used to recursively visit
29053  * children
29054  *
29055  * \sa Ast::visit_children for example.
29056  */
29057  void visit_children(visitor::ConstVisitor &v) const override;
29058 
29059  /**
29060  * \brief accept (or visit) the current AST node using provided visitor
29061  *
29062  * Instead of visiting children of AST node, like Ast::visit_children,
29063  * accept allows to visit the current node itself using provided concrete
29064  * visitor.
29065  *
29066  * \param v Concrete visitor that will be used to recursively visit node
29067  *
29068  * \sa Ast::accept for example.
29069  */
29070  void accept(visitor::Visitor &v) override;
29071 
29072  /**
29073  * \copydoc accept(visitor::Visitor&)
29074  */
29075  void accept(visitor::ConstVisitor &v) const override;
29076 
29077  /// \}
29078 
29079 private:
29080  /**
29081  * \brief Set this object as parent for all the children
29082  *
29083  * This should be called in every object (with children) constructor
29084  * to set parents. Since it is called only in the constructors it
29085  * should not be virtual to avoid ambiguities (issue #295).
29086  */
29087  void set_parent_in_children();
29088 };
29089 
29090 /** @} */ // end of ast_class
29091 
29092 } // namespace ast
29093 } // namespace nmodl
29094 #endif // !NMODL_AST_TABLE_STATEMENT_HPP
29095 #ifndef NMODL_AST_SUFFIX_HPP
29096 #define NMODL_AST_SUFFIX_HPP
29097 
29098 namespace nmodl {
29099 namespace ast {
29100 
29101 /**
29102  * @addtogroup ast_class
29103  * @ingroup ast
29104  * @{
29105  */
29106 
29107 /**
29108  * \brief Represents SUFFIX statement in NMODL
29109  *
29110  *
29111  */
29112 class Suffix : public Statement {
29113 private:
29114  /// type of channel
29115  std::shared_ptr<Name> type;
29116  /// Name of the channel
29117  std::shared_ptr<Name> name;
29118  /// token with location information
29119  std::shared_ptr<ModToken> token;
29120 
29121 public:
29122  /// \name Ctor & dtor
29123  /// \{
29124 
29125  explicit Suffix(Name *type, Name *name);
29126  explicit Suffix(const std::shared_ptr<Name> &type,
29127  const std::shared_ptr<Name> &name);
29128  Suffix(const Suffix &obj);
29129 
29130  virtual ~Suffix() = default;
29131 
29132  /// \}
29133 
29134  /**
29135  * \brief Check if the ast node is an instance of ast::Suffix
29136  * \return true as object is of type ast::Suffix
29137  */
29138  bool is_suffix() const noexcept override { return true; }
29139 
29140  /**
29141  * \brief Return a copy of the current node
29142  *
29143  * Recursively make a new copy/clone of the current node including
29144  * all members and return a pointer to the node. This is used for
29145  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
29146  * ast.
29147  *
29148  * @return pointer to the clone/copy of the current node
29149  */
29150  Suffix *clone() const override { return new Suffix(*this); }
29151 
29152  /// \name Getters
29153  /// \{
29154 
29155  /**
29156  * \brief Return type (ast::AstNodeType) of ast node
29157  *
29158  * Every node in the ast has a type defined in ast::AstNodeType and this
29159  * function is used to retrieve the same.
29160  *
29161  * \return ast node type i.e. ast::AstNodeType::SUFFIX
29162  *
29163  * \sa Ast::get_node_type_name
29164  */
29165  AstNodeType get_node_type() const noexcept override {
29166  return AstNodeType::SUFFIX;
29167  }
29168 
29169  /**
29170  * \brief Return type (ast::AstNodeType) of ast node as std::string
29171  *
29172  * Every node in the ast has a type defined in ast::AstNodeType.
29173  * This type name can be returned as a std::string for printing
29174  * node to text/json form.
29175  *
29176  * \return name of the node type as a string i.e. "Suffix"
29177  *
29178  * \sa Ast::get_node_name
29179  */
29180  std::string get_node_type_name() const noexcept override { return "Suffix"; }
29181 
29182  /**
29183  * \brief Get std::shared_ptr from `this` pointer of the current ast node
29184  */
29185  std::shared_ptr<Ast> get_shared_ptr() override {
29186  return std::static_pointer_cast<Suffix>(shared_from_this());
29187  }
29188 
29189  /**
29190  * \brief Get std::shared_ptr from `this` pointer of the current ast node
29191  */
29192  std::shared_ptr<const Ast> get_shared_ptr() const override {
29193  return std::static_pointer_cast<const Suffix>(shared_from_this());
29194  }
29195 
29196  /**
29197  * \brief Return associated token for the current ast node
29198  *
29199  * Not all ast nodes have token information. For example,
29200  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
29201  * solution of ODEs. In this case, we return nullptr to store in the
29202  * nmodl::symtab::SymbolTable.
29203  *
29204  * \return pointer to token if exist otherwise nullptr
29205  */
29206  const ModToken *get_token() const noexcept override { return token.get(); }
29207 
29208  /**
29209  * \brief Getter for member variable \ref Suffix.type
29210  */
29211  const std::shared_ptr<Name> &get_type() const noexcept { return type; }
29212 
29213  /**
29214  * \brief Return name of the node
29215  *
29216  * Some ast nodes have a member marked designated as node name. For example,
29217  * in case of this ast::Name has name designated as a
29218  * node name.
29219  *
29220  * @return name of the node as std::string
29221  *
29222  * \sa Ast::get_node_type_name
29223  */
29224  std::string get_node_name() const override;
29225 
29226  /**
29227  * \brief Getter for member variable \ref Suffix.name
29228  */
29229  const std::shared_ptr<Name> &get_name() const noexcept { return name; }
29230 
29231  /// \}
29232 
29233  /// \name Setters
29234  /// \{
29235 
29236  /**
29237  * \brief Set token for the current ast node
29238  */
29239  void set_token(const ModToken &tok) {
29240  token = std::make_shared<ModToken>(tok);
29241  }
29242 
29243  /**
29244  * \brief Setter for member variable \ref Suffix.type (rvalue reference)
29245  */
29246  void set_type(std::shared_ptr<Name> &&type);
29247 
29248  /**
29249  * \brief Setter for member variable \ref Suffix.type
29250  */
29251  void set_type(const std::shared_ptr<Name> &type);
29252 
29253  /**
29254  * \brief Setter for member variable \ref Suffix.name (rvalue reference)
29255  */
29256  void set_name(std::shared_ptr<Name> &&name);
29257 
29258  /**
29259  * \brief Setter for member variable \ref Suffix.name
29260  */
29261  void set_name(const std::shared_ptr<Name> &name);
29262 
29263  /// \}
29264 
29265  /// \name Visitor
29266  /// \{
29267 
29268  /**
29269  * \brief visit children i.e. member variables of current node using provided
29270  * visitor
29271  *
29272  * Different nodes in the AST have different members (i.e. children). This
29273  * method recursively visits children using provided visitor.
29274  *
29275  * \param v Concrete visitor that will be used to recursively visit children
29276  *
29277  * \sa Ast::visit_children for example.
29278  */
29279  void visit_children(visitor::Visitor &v) override;
29280 
29281  /**
29282  * \brief visit children i.e. member variables of current node using provided
29283  * visitor
29284  *
29285  * Different nodes in the AST have different members (i.e. children). This
29286  * method recursively visits children using provided visitor.
29287  *
29288  * \param v Concrete constant visitor that will be used to recursively visit
29289  * children
29290  *
29291  * \sa Ast::visit_children for example.
29292  */
29293  void visit_children(visitor::ConstVisitor &v) const override;
29294 
29295  /**
29296  * \brief accept (or visit) the current AST node using provided visitor
29297  *
29298  * Instead of visiting children of AST node, like Ast::visit_children,
29299  * accept allows to visit the current node itself using provided concrete
29300  * visitor.
29301  *
29302  * \param v Concrete visitor that will be used to recursively visit node
29303  *
29304  * \sa Ast::accept for example.
29305  */
29306  void accept(visitor::Visitor &v) override;
29307 
29308  /**
29309  * \copydoc accept(visitor::Visitor&)
29310  */
29311  void accept(visitor::ConstVisitor &v) const override;
29312 
29313  /// \}
29314 
29315 private:
29316  /**
29317  * \brief Set this object as parent for all the children
29318  *
29319  * This should be called in every object (with children) constructor
29320  * to set parents. Since it is called only in the constructors it
29321  * should not be virtual to avoid ambiguities (issue #295).
29322  */
29323  void set_parent_in_children();
29324 };
29325 
29326 /** @} */ // end of ast_class
29327 
29328 } // namespace ast
29329 } // namespace nmodl
29330 #endif // !NMODL_AST_SUFFIX_HPP
29331 #ifndef NMODL_AST_USEION_HPP
29332 #define NMODL_AST_USEION_HPP
29333 
29334 namespace nmodl {
29335 namespace ast {
29336 
29337 /**
29338  * @addtogroup ast_class
29339  * @ingroup ast
29340  * @{
29341  */
29342 
29343 /**
29344  * \brief Represents USEION statement in NMODL
29345  *
29346  *
29347  */
29348 class Useion : public Statement {
29349 private:
29350  /// Name of ion
29351  std::shared_ptr<Name> name;
29352  /// Variables being read
29354  /// Variables being written
29356  /// (TODO)
29357  std::shared_ptr<Valence> valence;
29358  /// Ontology to indicate the chemical ion
29359  std::shared_ptr<String> ontology_id;
29360  /// token with location information
29361  std::shared_ptr<ModToken> token;
29362 
29363 public:
29364  /// \name Ctor & dtor
29365  /// \{
29366 
29367  explicit Useion(Name *name, ReadIonVarVector readlist,
29368  WriteIonVarVector writelist, Valence *valence,
29369  String *ontology_id);
29370  explicit Useion(const std::shared_ptr<Name> &name,
29371  const ReadIonVarVector &readlist,
29372  const WriteIonVarVector &writelist,
29373  const std::shared_ptr<Valence> &valence,
29374  const std::shared_ptr<String> &ontology_id);
29375  Useion(const Useion &obj);
29376 
29377  virtual ~Useion() = default;
29378 
29379  /// \}
29380 
29381  /**
29382  * \brief Check if the ast node is an instance of ast::Useion
29383  * \return true as object is of type ast::Useion
29384  */
29385  bool is_useion() const noexcept override { return true; }
29386 
29387  /**
29388  * \brief Return a copy of the current node
29389  *
29390  * Recursively make a new copy/clone of the current node including
29391  * all members and return a pointer to the node. This is used for
29392  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
29393  * ast.
29394  *
29395  * @return pointer to the clone/copy of the current node
29396  */
29397  Useion *clone() const override { return new Useion(*this); }
29398 
29399  /// \name Getters
29400  /// \{
29401 
29402  /**
29403  * \brief Return type (ast::AstNodeType) of ast node
29404  *
29405  * Every node in the ast has a type defined in ast::AstNodeType and this
29406  * function is used to retrieve the same.
29407  *
29408  * \return ast node type i.e. ast::AstNodeType::USEION
29409  *
29410  * \sa Ast::get_node_type_name
29411  */
29412  AstNodeType get_node_type() const noexcept override {
29413  return AstNodeType::USEION;
29414  }
29415 
29416  /**
29417  * \brief Return type (ast::AstNodeType) of ast node as std::string
29418  *
29419  * Every node in the ast has a type defined in ast::AstNodeType.
29420  * This type name can be returned as a std::string for printing
29421  * node to text/json form.
29422  *
29423  * \return name of the node type as a string i.e. "Useion"
29424  *
29425  * \sa Ast::get_node_name
29426  */
29427  std::string get_node_type_name() const noexcept override { return "Useion"; }
29428 
29429  /**
29430  * \brief Return NMODL statement of ast node as std::string
29431  *
29432  * Every node is related to a special statement in the NMODL. This
29433  * statement can be returned as a std::string for printing to
29434  * text/json form.
29435  *
29436  * \return name of the statement as a string i.e. "USEION "
29437  *
29438  * \sa Ast::get_nmodl_name
29439  */
29440  std::string get_nmodl_name() const noexcept override { return "USEION "; }
29441 
29442  /**
29443  * \brief Get std::shared_ptr from `this` pointer of the current ast node
29444  */
29445  std::shared_ptr<Ast> get_shared_ptr() override {
29446  return std::static_pointer_cast<Useion>(shared_from_this());
29447  }
29448 
29449  /**
29450  * \brief Get std::shared_ptr from `this` pointer of the current ast node
29451  */
29452  std::shared_ptr<const Ast> get_shared_ptr() const override {
29453  return std::static_pointer_cast<const Useion>(shared_from_this());
29454  }
29455 
29456  /**
29457  * \brief Return associated token for the current ast node
29458  *
29459  * Not all ast nodes have token information. For example,
29460  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
29461  * solution of ODEs. In this case, we return nullptr to store in the
29462  * nmodl::symtab::SymbolTable.
29463  *
29464  * \return pointer to token if exist otherwise nullptr
29465  */
29466  const ModToken *get_token() const noexcept override { return token.get(); }
29467 
29468  /**
29469  * \brief Return name of the node
29470  *
29471  * Some ast nodes have a member marked designated as node name. For example,
29472  * in case of this ast::Name has name designated as a
29473  * node name.
29474  *
29475  * @return name of the node as std::string
29476  *
29477  * \sa Ast::get_node_type_name
29478  */
29479  std::string get_node_name() const override;
29480 
29481  /**
29482  * \brief Getter for member variable \ref Useion.name
29483  */
29484  const std::shared_ptr<Name> &get_name() const noexcept { return name; }
29485 
29486  /**
29487  * \brief Getter for member variable \ref Useion.readlist
29488  */
29489  const ReadIonVarVector &get_readlist() const noexcept { return readlist; }
29490 
29491  /**
29492  * \brief Getter for member variable \ref Useion.writelist
29493  */
29494  const WriteIonVarVector &get_writelist() const noexcept { return writelist; }
29495 
29496  /**
29497  * \brief Getter for member variable \ref Useion.valence
29498  */
29499  const std::shared_ptr<Valence> &get_valence() const noexcept {
29500  return valence;
29501  }
29502 
29503  /**
29504  * \brief Getter for member variable \ref Useion.ontology_id
29505  */
29506  const std::shared_ptr<String> &get_ontology_id() const noexcept {
29507  return ontology_id;
29508  }
29509 
29510  /// \}
29511 
29512  /// \name Setters
29513  /// \{
29514 
29515  /**
29516  * \brief Set token for the current ast node
29517  */
29518  void set_token(const ModToken &tok) {
29519  token = std::make_shared<ModToken>(tok);
29520  }
29521 
29522  /**
29523  * \brief Setter for member variable \ref Useion.name (rvalue reference)
29524  */
29525  void set_name(std::shared_ptr<Name> &&name);
29526 
29527  /**
29528  * \brief Setter for member variable \ref Useion.name
29529  */
29530  void set_name(const std::shared_ptr<Name> &name);
29531 
29532  /**
29533  * \brief Setter for member variable \ref Useion.readlist (rvalue reference)
29534  */
29535  void set_readlist(ReadIonVarVector &&readlist);
29536 
29537  /**
29538  * \brief Setter for member variable \ref Useion.readlist
29539  */
29540  void set_readlist(const ReadIonVarVector &readlist);
29541 
29542  /**
29543  * \brief Setter for member variable \ref Useion.writelist (rvalue reference)
29544  */
29545  void set_writelist(WriteIonVarVector &&writelist);
29546 
29547  /**
29548  * \brief Setter for member variable \ref Useion.writelist
29549  */
29550  void set_writelist(const WriteIonVarVector &writelist);
29551 
29552  /**
29553  * \brief Setter for member variable \ref Useion.valence (rvalue reference)
29554  */
29555  void set_valence(std::shared_ptr<Valence> &&valence);
29556 
29557  /**
29558  * \brief Setter for member variable \ref Useion.valence
29559  */
29560  void set_valence(const std::shared_ptr<Valence> &valence);
29561 
29562  /**
29563  * \brief Setter for member variable \ref Useion.ontology_id (rvalue
29564  * reference)
29565  */
29566  void set_ontology_id(std::shared_ptr<String> &&ontology_id);
29567 
29568  /**
29569  * \brief Setter for member variable \ref Useion.ontology_id
29570  */
29571  void set_ontology_id(const std::shared_ptr<String> &ontology_id);
29572 
29573  /// \}
29574 
29575  /// \name Visitor
29576  /// \{
29577 
29578  /**
29579  * \brief visit children i.e. member variables of current node using provided
29580  * visitor
29581  *
29582  * Different nodes in the AST have different members (i.e. children). This
29583  * method recursively visits children using provided visitor.
29584  *
29585  * \param v Concrete visitor that will be used to recursively visit children
29586  *
29587  * \sa Ast::visit_children for example.
29588  */
29589  void visit_children(visitor::Visitor &v) override;
29590 
29591  /**
29592  * \brief visit children i.e. member variables of current node using provided
29593  * visitor
29594  *
29595  * Different nodes in the AST have different members (i.e. children). This
29596  * method recursively visits children using provided visitor.
29597  *
29598  * \param v Concrete constant visitor that will be used to recursively visit
29599  * children
29600  *
29601  * \sa Ast::visit_children for example.
29602  */
29603  void visit_children(visitor::ConstVisitor &v) const override;
29604 
29605  /**
29606  * \brief accept (or visit) the current AST node using provided visitor
29607  *
29608  * Instead of visiting children of AST node, like Ast::visit_children,
29609  * accept allows to visit the current node itself using provided concrete
29610  * visitor.
29611  *
29612  * \param v Concrete visitor that will be used to recursively visit node
29613  *
29614  * \sa Ast::accept for example.
29615  */
29616  void accept(visitor::Visitor &v) override;
29617 
29618  /**
29619  * \copydoc accept(visitor::Visitor&)
29620  */
29621  void accept(visitor::ConstVisitor &v) const override;
29622 
29623  /// \}
29624 
29625 private:
29626  /**
29627  * \brief Set this object as parent for all the children
29628  *
29629  * This should be called in every object (with children) constructor
29630  * to set parents. Since it is called only in the constructors it
29631  * should not be virtual to avoid ambiguities (issue #295).
29632  */
29633  void set_parent_in_children();
29634 };
29635 
29636 /** @} */ // end of ast_class
29637 
29638 } // namespace ast
29639 } // namespace nmodl
29640 #endif // !NMODL_AST_USEION_HPP
29641 #ifndef NMODL_AST_NONSPECIFIC_HPP
29642 #define NMODL_AST_NONSPECIFIC_HPP
29643 
29644 namespace nmodl {
29645 namespace ast {
29646 
29647 /**
29648  * @addtogroup ast_class
29649  * @ingroup ast
29650  * @{
29651  */
29652 
29653 /**
29654  * \brief Represents NONSPECIFIC_CURRENT variables statement in NMODL
29655  *
29656  *
29657  */
29658 class Nonspecific : public Statement {
29659 private:
29660  /// Vector of non specific variables
29662  /// token with location information
29663  std::shared_ptr<ModToken> token;
29664 
29665 public:
29666  /// \name Ctor & dtor
29667  /// \{
29668 
29669  explicit Nonspecific(NonspecificCurVarVector currents);
29670  Nonspecific(const Nonspecific &obj);
29671 
29672  virtual ~Nonspecific() = default;
29673 
29674  /// \}
29675 
29676  /**
29677  * \brief Check if the ast node is an instance of ast::Nonspecific
29678  * \return true as object is of type ast::Nonspecific
29679  */
29680  bool is_nonspecific() const noexcept override { return true; }
29681 
29682  /**
29683  * \brief Return a copy of the current node
29684  *
29685  * Recursively make a new copy/clone of the current node including
29686  * all members and return a pointer to the node. This is used for
29687  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
29688  * ast.
29689  *
29690  * @return pointer to the clone/copy of the current node
29691  */
29692  Nonspecific *clone() const override { return new Nonspecific(*this); }
29693 
29694  /// \name Getters
29695  /// \{
29696 
29697  /**
29698  * \brief Return type (ast::AstNodeType) of ast node
29699  *
29700  * Every node in the ast has a type defined in ast::AstNodeType and this
29701  * function is used to retrieve the same.
29702  *
29703  * \return ast node type i.e. ast::AstNodeType::NONSPECIFIC
29704  *
29705  * \sa Ast::get_node_type_name
29706  */
29707  AstNodeType get_node_type() const noexcept override {
29708  return AstNodeType::NONSPECIFIC;
29709  }
29710 
29711  /**
29712  * \brief Return type (ast::AstNodeType) of ast node as std::string
29713  *
29714  * Every node in the ast has a type defined in ast::AstNodeType.
29715  * This type name can be returned as a std::string for printing
29716  * node to text/json form.
29717  *
29718  * \return name of the node type as a string i.e. "Nonspecific"
29719  *
29720  * \sa Ast::get_node_name
29721  */
29722  std::string get_node_type_name() const noexcept override {
29723  return "Nonspecific";
29724  }
29725 
29726  /**
29727  * \brief Return NMODL statement of ast node as std::string
29728  *
29729  * Every node is related to a special statement in the NMODL. This
29730  * statement can be returned as a std::string for printing to
29731  * text/json form.
29732  *
29733  * \return name of the statement as a string i.e. "NONSPECIFIC_CURRENT "
29734  *
29735  * \sa Ast::get_nmodl_name
29736  */
29737  std::string get_nmodl_name() const noexcept override {
29738  return "NONSPECIFIC_CURRENT ";
29739  }
29740 
29741  /**
29742  * \brief Get std::shared_ptr from `this` pointer of the current ast node
29743  */
29744  std::shared_ptr<Ast> get_shared_ptr() override {
29745  return std::static_pointer_cast<Nonspecific>(shared_from_this());
29746  }
29747 
29748  /**
29749  * \brief Get std::shared_ptr from `this` pointer of the current ast node
29750  */
29751  std::shared_ptr<const Ast> get_shared_ptr() const override {
29752  return std::static_pointer_cast<const Nonspecific>(shared_from_this());
29753  }
29754 
29755  /**
29756  * \brief Return associated token for the current ast node
29757  *
29758  * Not all ast nodes have token information. For example,
29759  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
29760  * solution of ODEs. In this case, we return nullptr to store in the
29761  * nmodl::symtab::SymbolTable.
29762  *
29763  * \return pointer to token if exist otherwise nullptr
29764  */
29765  const ModToken *get_token() const noexcept override { return token.get(); }
29766 
29767  /**
29768  * \brief Getter for member variable \ref Nonspecific.currents
29769  */
29770  const NonspecificCurVarVector &get_currents() const noexcept {
29771  return currents;
29772  }
29773 
29774  /// \}
29775 
29776  /// \name Setters
29777  /// \{
29778 
29779  /**
29780  * \brief Set token for the current ast node
29781  */
29782  void set_token(const ModToken &tok) {
29783  token = std::make_shared<ModToken>(tok);
29784  }
29785 
29786  /**
29787  * \brief Setter for member variable \ref Nonspecific.currents (rvalue
29788  * reference)
29789  */
29790  void set_currents(NonspecificCurVarVector &&currents);
29791 
29792  /**
29793  * \brief Setter for member variable \ref Nonspecific.currents
29794  */
29795  void set_currents(const NonspecificCurVarVector &currents);
29796 
29797  /// \}
29798 
29799  /// \name Visitor
29800  /// \{
29801 
29802  /**
29803  * \brief visit children i.e. member variables of current node using provided
29804  * visitor
29805  *
29806  * Different nodes in the AST have different members (i.e. children). This
29807  * method recursively visits children using provided visitor.
29808  *
29809  * \param v Concrete visitor that will be used to recursively visit children
29810  *
29811  * \sa Ast::visit_children for example.
29812  */
29813  void visit_children(visitor::Visitor &v) override;
29814 
29815  /**
29816  * \brief visit children i.e. member variables of current node using provided
29817  * visitor
29818  *
29819  * Different nodes in the AST have different members (i.e. children). This
29820  * method recursively visits children using provided visitor.
29821  *
29822  * \param v Concrete constant visitor that will be used to recursively visit
29823  * children
29824  *
29825  * \sa Ast::visit_children for example.
29826  */
29827  void visit_children(visitor::ConstVisitor &v) const override;
29828 
29829  /**
29830  * \brief accept (or visit) the current AST node using provided visitor
29831  *
29832  * Instead of visiting children of AST node, like Ast::visit_children,
29833  * accept allows to visit the current node itself using provided concrete
29834  * visitor.
29835  *
29836  * \param v Concrete visitor that will be used to recursively visit node
29837  *
29838  * \sa Ast::accept for example.
29839  */
29840  void accept(visitor::Visitor &v) override;
29841 
29842  /**
29843  * \copydoc accept(visitor::Visitor&)
29844  */
29845  void accept(visitor::ConstVisitor &v) const override;
29846 
29847  /// \}
29848 
29849 private:
29850  /**
29851  * \brief Set this object as parent for all the children
29852  *
29853  * This should be called in every object (with children) constructor
29854  * to set parents. Since it is called only in the constructors it
29855  * should not be virtual to avoid ambiguities (issue #295).
29856  */
29857  void set_parent_in_children();
29858 };
29859 
29860 /** @} */ // end of ast_class
29861 
29862 } // namespace ast
29863 } // namespace nmodl
29864 #endif // !NMODL_AST_NONSPECIFIC_HPP
29865 #ifndef NMODL_AST_ELECTRODE_CURRENT_HPP
29866 #define NMODL_AST_ELECTRODE_CURRENT_HPP
29867 
29868 namespace nmodl {
29869 namespace ast {
29870 
29871 /**
29872  * @addtogroup ast_class
29873  * @ingroup ast
29874  * @{
29875  */
29876 
29877 /**
29878  * \brief Represents ELECTRODE_CURRENT variables statement in NMODL
29879  *
29880  *
29881  */
29882 class ElectrodeCurrent : public Statement {
29883 private:
29884  /// Vector of electrode current variables
29886  /// token with location information
29887  std::shared_ptr<ModToken> token;
29888 
29889 public:
29890  /// \name Ctor & dtor
29891  /// \{
29892 
29893  explicit ElectrodeCurrent(ElectrodeCurVarVector currents);
29894  ElectrodeCurrent(const ElectrodeCurrent &obj);
29895 
29896  virtual ~ElectrodeCurrent() = default;
29897 
29898  /// \}
29899 
29900  /**
29901  * \brief Check if the ast node is an instance of ast::ElectrodeCurrent
29902  * \return true as object is of type ast::ElectrodeCurrent
29903  */
29904  bool is_electrode_current() const noexcept override { return true; }
29905 
29906  /**
29907  * \brief Return a copy of the current node
29908  *
29909  * Recursively make a new copy/clone of the current node including
29910  * all members and return a pointer to the node. This is used for
29911  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
29912  * ast.
29913  *
29914  * @return pointer to the clone/copy of the current node
29915  */
29916  ElectrodeCurrent *clone() const override {
29917  return new ElectrodeCurrent(*this);
29918  }
29919 
29920  /// \name Getters
29921  /// \{
29922 
29923  /**
29924  * \brief Return type (ast::AstNodeType) of ast node
29925  *
29926  * Every node in the ast has a type defined in ast::AstNodeType and this
29927  * function is used to retrieve the same.
29928  *
29929  * \return ast node type i.e. ast::AstNodeType::ELECTRODE_CURRENT
29930  *
29931  * \sa Ast::get_node_type_name
29932  */
29933  AstNodeType get_node_type() const noexcept override {
29935  }
29936 
29937  /**
29938  * \brief Return type (ast::AstNodeType) of ast node as std::string
29939  *
29940  * Every node in the ast has a type defined in ast::AstNodeType.
29941  * This type name can be returned as a std::string for printing
29942  * node to text/json form.
29943  *
29944  * \return name of the node type as a string i.e. "ElectrodeCurrent"
29945  *
29946  * \sa Ast::get_node_name
29947  */
29948  std::string get_node_type_name() const noexcept override {
29949  return "ElectrodeCurrent";
29950  }
29951 
29952  /**
29953  * \brief Return NMODL statement of ast node as std::string
29954  *
29955  * Every node is related to a special statement in the NMODL. This
29956  * statement can be returned as a std::string for printing to
29957  * text/json form.
29958  *
29959  * \return name of the statement as a string i.e. "ELECTRODE_CURRENT "
29960  *
29961  * \sa Ast::get_nmodl_name
29962  */
29963  std::string get_nmodl_name() const noexcept override {
29964  return "ELECTRODE_CURRENT ";
29965  }
29966 
29967  /**
29968  * \brief Get std::shared_ptr from `this` pointer of the current ast node
29969  */
29970  std::shared_ptr<Ast> get_shared_ptr() override {
29971  return std::static_pointer_cast<ElectrodeCurrent>(shared_from_this());
29972  }
29973 
29974  /**
29975  * \brief Get std::shared_ptr from `this` pointer of the current ast node
29976  */
29977  std::shared_ptr<const Ast> get_shared_ptr() const override {
29978  return std::static_pointer_cast<const ElectrodeCurrent>(shared_from_this());
29979  }
29980 
29981  /**
29982  * \brief Return associated token for the current ast node
29983  *
29984  * Not all ast nodes have token information. For example,
29985  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
29986  * solution of ODEs. In this case, we return nullptr to store in the
29987  * nmodl::symtab::SymbolTable.
29988  *
29989  * \return pointer to token if exist otherwise nullptr
29990  */
29991  const ModToken *get_token() const noexcept override { return token.get(); }
29992 
29993  /**
29994  * \brief Getter for member variable \ref ElectrodeCurrent.currents
29995  */
29996  const ElectrodeCurVarVector &get_currents() const noexcept {
29997  return currents;
29998  }
29999 
30000  /// \}
30001 
30002  /// \name Setters
30003  /// \{
30004 
30005  /**
30006  * \brief Set token for the current ast node
30007  */
30008  void set_token(const ModToken &tok) {
30009  token = std::make_shared<ModToken>(tok);
30010  }
30011 
30012  /**
30013  * \brief Setter for member variable \ref ElectrodeCurrent.currents (rvalue
30014  * reference)
30015  */
30016  void set_currents(ElectrodeCurVarVector &&currents);
30017 
30018  /**
30019  * \brief Setter for member variable \ref ElectrodeCurrent.currents
30020  */
30021  void set_currents(const ElectrodeCurVarVector &currents);
30022 
30023  /// \}
30024 
30025  /// \name Visitor
30026  /// \{
30027 
30028  /**
30029  * \brief visit children i.e. member variables of current node using provided
30030  * visitor
30031  *
30032  * Different nodes in the AST have different members (i.e. children). This
30033  * method recursively visits children using provided visitor.
30034  *
30035  * \param v Concrete visitor that will be used to recursively visit children
30036  *
30037  * \sa Ast::visit_children for example.
30038  */
30039  void visit_children(visitor::Visitor &v) override;
30040 
30041  /**
30042  * \brief visit children i.e. member variables of current node using provided
30043  * visitor
30044  *
30045  * Different nodes in the AST have different members (i.e. children). This
30046  * method recursively visits children using provided visitor.
30047  *
30048  * \param v Concrete constant visitor that will be used to recursively visit
30049  * children
30050  *
30051  * \sa Ast::visit_children for example.
30052  */
30053  void visit_children(visitor::ConstVisitor &v) const override;
30054 
30055  /**
30056  * \brief accept (or visit) the current AST node using provided visitor
30057  *
30058  * Instead of visiting children of AST node, like Ast::visit_children,
30059  * accept allows to visit the current node itself using provided concrete
30060  * visitor.
30061  *
30062  * \param v Concrete visitor that will be used to recursively visit node
30063  *
30064  * \sa Ast::accept for example.
30065  */
30066  void accept(visitor::Visitor &v) override;
30067 
30068  /**
30069  * \copydoc accept(visitor::Visitor&)
30070  */
30071  void accept(visitor::ConstVisitor &v) const override;
30072 
30073  /// \}
30074 
30075 private:
30076  /**
30077  * \brief Set this object as parent for all the children
30078  *
30079  * This should be called in every object (with children) constructor
30080  * to set parents. Since it is called only in the constructors it
30081  * should not be virtual to avoid ambiguities (issue #295).
30082  */
30083  void set_parent_in_children();
30084 };
30085 
30086 /** @} */ // end of ast_class
30087 
30088 } // namespace ast
30089 } // namespace nmodl
30090 #endif // !NMODL_AST_ELECTRODE_CURRENT_HPP
30091 #ifndef NMODL_AST_SECTION_HPP
30092 #define NMODL_AST_SECTION_HPP
30093 
30094 namespace nmodl {
30095 namespace ast {
30096 
30097 /**
30098  * @addtogroup ast_class
30099  * @ingroup ast
30100  * @{
30101  */
30102 
30103 /**
30104  * \brief Represents SECTION variables statement in NMODL
30105  *
30106  *
30107  */
30108 class Section : public Statement {
30109 private:
30110  /// Vector of section variables
30112  /// token with location information
30113  std::shared_ptr<ModToken> token;
30114 
30115 public:
30116  /// \name Ctor & dtor
30117  /// \{
30118 
30119  explicit Section(SectionVarVector sections);
30120  Section(const Section &obj);
30121 
30122  virtual ~Section() = default;
30123 
30124  /// \}
30125 
30126  /**
30127  * \brief Check if the ast node is an instance of ast::Section
30128  * \return true as object is of type ast::Section
30129  */
30130  bool is_section() const noexcept override { return true; }
30131 
30132  /**
30133  * \brief Return a copy of the current node
30134  *
30135  * Recursively make a new copy/clone of the current node including
30136  * all members and return a pointer to the node. This is used for
30137  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
30138  * ast.
30139  *
30140  * @return pointer to the clone/copy of the current node
30141  */
30142  Section *clone() const override { return new Section(*this); }
30143 
30144  /// \name Getters
30145  /// \{
30146 
30147  /**
30148  * \brief Return type (ast::AstNodeType) of ast node
30149  *
30150  * Every node in the ast has a type defined in ast::AstNodeType and this
30151  * function is used to retrieve the same.
30152  *
30153  * \return ast node type i.e. ast::AstNodeType::SECTION
30154  *
30155  * \sa Ast::get_node_type_name
30156  */
30157  AstNodeType get_node_type() const noexcept override {
30158  return AstNodeType::SECTION;
30159  }
30160 
30161  /**
30162  * \brief Return type (ast::AstNodeType) of ast node as std::string
30163  *
30164  * Every node in the ast has a type defined in ast::AstNodeType.
30165  * This type name can be returned as a std::string for printing
30166  * node to text/json form.
30167  *
30168  * \return name of the node type as a string i.e. "Section"
30169  *
30170  * \sa Ast::get_node_name
30171  */
30172  std::string get_node_type_name() const noexcept override { return "Section"; }
30173 
30174  /**
30175  * \brief Return NMODL statement of ast node as std::string
30176  *
30177  * Every node is related to a special statement in the NMODL. This
30178  * statement can be returned as a std::string for printing to
30179  * text/json form.
30180  *
30181  * \return name of the statement as a string i.e. "SECTION "
30182  *
30183  * \sa Ast::get_nmodl_name
30184  */
30185  std::string get_nmodl_name() const noexcept override { return "SECTION "; }
30186 
30187  /**
30188  * \brief Get std::shared_ptr from `this` pointer of the current ast node
30189  */
30190  std::shared_ptr<Ast> get_shared_ptr() override {
30191  return std::static_pointer_cast<Section>(shared_from_this());
30192  }
30193 
30194  /**
30195  * \brief Get std::shared_ptr from `this` pointer of the current ast node
30196  */
30197  std::shared_ptr<const Ast> get_shared_ptr() const override {
30198  return std::static_pointer_cast<const Section>(shared_from_this());
30199  }
30200 
30201  /**
30202  * \brief Return associated token for the current ast node
30203  *
30204  * Not all ast nodes have token information. For example,
30205  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
30206  * solution of ODEs. In this case, we return nullptr to store in the
30207  * nmodl::symtab::SymbolTable.
30208  *
30209  * \return pointer to token if exist otherwise nullptr
30210  */
30211  const ModToken *get_token() const noexcept override { return token.get(); }
30212 
30213  /**
30214  * \brief Getter for member variable \ref Section.sections
30215  */
30216  const SectionVarVector &get_sections() const noexcept { return sections; }
30217 
30218  /// \}
30219 
30220  /// \name Setters
30221  /// \{
30222 
30223  /**
30224  * \brief Set token for the current ast node
30225  */
30226  void set_token(const ModToken &tok) {
30227  token = std::make_shared<ModToken>(tok);
30228  }
30229 
30230  /**
30231  * \brief Setter for member variable \ref Section.sections (rvalue reference)
30232  */
30233  void set_sections(SectionVarVector &&sections);
30234 
30235  /**
30236  * \brief Setter for member variable \ref Section.sections
30237  */
30238  void set_sections(const SectionVarVector &sections);
30239 
30240  /// \}
30241 
30242  /// \name Visitor
30243  /// \{
30244 
30245  /**
30246  * \brief visit children i.e. member variables of current node using provided
30247  * visitor
30248  *
30249  * Different nodes in the AST have different members (i.e. children). This
30250  * method recursively visits children using provided visitor.
30251  *
30252  * \param v Concrete visitor that will be used to recursively visit children
30253  *
30254  * \sa Ast::visit_children for example.
30255  */
30256  void visit_children(visitor::Visitor &v) override;
30257 
30258  /**
30259  * \brief visit children i.e. member variables of current node using provided
30260  * visitor
30261  *
30262  * Different nodes in the AST have different members (i.e. children). This
30263  * method recursively visits children using provided visitor.
30264  *
30265  * \param v Concrete constant visitor that will be used to recursively visit
30266  * children
30267  *
30268  * \sa Ast::visit_children for example.
30269  */
30270  void visit_children(visitor::ConstVisitor &v) const override;
30271 
30272  /**
30273  * \brief accept (or visit) the current AST node using provided visitor
30274  *
30275  * Instead of visiting children of AST node, like Ast::visit_children,
30276  * accept allows to visit the current node itself using provided concrete
30277  * visitor.
30278  *
30279  * \param v Concrete visitor that will be used to recursively visit node
30280  *
30281  * \sa Ast::accept for example.
30282  */
30283  void accept(visitor::Visitor &v) override;
30284 
30285  /**
30286  * \copydoc accept(visitor::Visitor&)
30287  */
30288  void accept(visitor::ConstVisitor &v) const override;
30289 
30290  /// \}
30291 
30292 private:
30293  /**
30294  * \brief Set this object as parent for all the children
30295  *
30296  * This should be called in every object (with children) constructor
30297  * to set parents. Since it is called only in the constructors it
30298  * should not be virtual to avoid ambiguities (issue #295).
30299  */
30300  void set_parent_in_children();
30301 };
30302 
30303 /** @} */ // end of ast_class
30304 
30305 } // namespace ast
30306 } // namespace nmodl
30307 #endif // !NMODL_AST_SECTION_HPP
30308 #ifndef NMODL_AST_RANGE_HPP
30309 #define NMODL_AST_RANGE_HPP
30310 
30311 namespace nmodl {
30312 namespace ast {
30313 
30314 /**
30315  * @addtogroup ast_class
30316  * @ingroup ast
30317  * @{
30318  */
30319 
30320 /**
30321  * \brief Represents RANGE variables statement in NMODL
30322  *
30323  *
30324  */
30325 class Range : public Statement {
30326 private:
30327  /// Vector of range variables
30329  /// token with location information
30330  std::shared_ptr<ModToken> token;
30331 
30332 public:
30333  /// \name Ctor & dtor
30334  /// \{
30335 
30336  explicit Range(RangeVarVector variables);
30337  Range(const Range &obj);
30338 
30339  virtual ~Range() = default;
30340 
30341  /// \}
30342 
30343  /**
30344  * \brief Check if the ast node is an instance of ast::Range
30345  * \return true as object is of type ast::Range
30346  */
30347  bool is_range() const noexcept override { return true; }
30348 
30349  /**
30350  * \brief Return a copy of the current node
30351  *
30352  * Recursively make a new copy/clone of the current node including
30353  * all members and return a pointer to the node. This is used for
30354  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
30355  * ast.
30356  *
30357  * @return pointer to the clone/copy of the current node
30358  */
30359  Range *clone() const override { return new Range(*this); }
30360 
30361  /// \name Getters
30362  /// \{
30363 
30364  /**
30365  * \brief Return type (ast::AstNodeType) of ast node
30366  *
30367  * Every node in the ast has a type defined in ast::AstNodeType and this
30368  * function is used to retrieve the same.
30369  *
30370  * \return ast node type i.e. ast::AstNodeType::RANGE
30371  *
30372  * \sa Ast::get_node_type_name
30373  */
30374  AstNodeType get_node_type() const noexcept override {
30375  return AstNodeType::RANGE;
30376  }
30377 
30378  /**
30379  * \brief Return type (ast::AstNodeType) of ast node as std::string
30380  *
30381  * Every node in the ast has a type defined in ast::AstNodeType.
30382  * This type name can be returned as a std::string for printing
30383  * node to text/json form.
30384  *
30385  * \return name of the node type as a string i.e. "Range"
30386  *
30387  * \sa Ast::get_node_name
30388  */
30389  std::string get_node_type_name() const noexcept override { return "Range"; }
30390 
30391  /**
30392  * \brief Return NMODL statement of ast node as std::string
30393  *
30394  * Every node is related to a special statement in the NMODL. This
30395  * statement can be returned as a std::string for printing to
30396  * text/json form.
30397  *
30398  * \return name of the statement as a string i.e. "RANGE "
30399  *
30400  * \sa Ast::get_nmodl_name
30401  */
30402  std::string get_nmodl_name() const noexcept override { return "RANGE "; }
30403 
30404  /**
30405  * \brief Get std::shared_ptr from `this` pointer of the current ast node
30406  */
30407  std::shared_ptr<Ast> get_shared_ptr() override {
30408  return std::static_pointer_cast<Range>(shared_from_this());
30409  }
30410 
30411  /**
30412  * \brief Get std::shared_ptr from `this` pointer of the current ast node
30413  */
30414  std::shared_ptr<const Ast> get_shared_ptr() const override {
30415  return std::static_pointer_cast<const Range>(shared_from_this());
30416  }
30417 
30418  /**
30419  * \brief Return associated token for the current ast node
30420  *
30421  * Not all ast nodes have token information. For example,
30422  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
30423  * solution of ODEs. In this case, we return nullptr to store in the
30424  * nmodl::symtab::SymbolTable.
30425  *
30426  * \return pointer to token if exist otherwise nullptr
30427  */
30428  const ModToken *get_token() const noexcept override { return token.get(); }
30429 
30430  /**
30431  * \brief Getter for member variable \ref Range.variables
30432  */
30433  const RangeVarVector &get_variables() const noexcept { return variables; }
30434 
30435  /// \}
30436 
30437  /// \name Setters
30438  /// \{
30439 
30440  /**
30441  * \brief Set token for the current ast node
30442  */
30443  void set_token(const ModToken &tok) {
30444  token = std::make_shared<ModToken>(tok);
30445  }
30446 
30447  /**
30448  * \brief Setter for member variable \ref Range.variables (rvalue reference)
30449  */
30450  void set_variables(RangeVarVector &&variables);
30451 
30452  /**
30453  * \brief Setter for member variable \ref Range.variables
30454  */
30455  void set_variables(const RangeVarVector &variables);
30456 
30457  /// \}
30458 
30459  /// \name Visitor
30460  /// \{
30461 
30462  /**
30463  * \brief visit children i.e. member variables of current node using provided
30464  * visitor
30465  *
30466  * Different nodes in the AST have different members (i.e. children). This
30467  * method recursively visits children using provided visitor.
30468  *
30469  * \param v Concrete visitor that will be used to recursively visit children
30470  *
30471  * \sa Ast::visit_children for example.
30472  */
30473  void visit_children(visitor::Visitor &v) override;
30474 
30475  /**
30476  * \brief visit children i.e. member variables of current node using provided
30477  * visitor
30478  *
30479  * Different nodes in the AST have different members (i.e. children). This
30480  * method recursively visits children using provided visitor.
30481  *
30482  * \param v Concrete constant visitor that will be used to recursively visit
30483  * children
30484  *
30485  * \sa Ast::visit_children for example.
30486  */
30487  void visit_children(visitor::ConstVisitor &v) const override;
30488 
30489  /**
30490  * \brief accept (or visit) the current AST node using provided visitor
30491  *
30492  * Instead of visiting children of AST node, like Ast::visit_children,
30493  * accept allows to visit the current node itself using provided concrete
30494  * visitor.
30495  *
30496  * \param v Concrete visitor that will be used to recursively visit node
30497  *
30498  * \sa Ast::accept for example.
30499  */
30500  void accept(visitor::Visitor &v) override;
30501 
30502  /**
30503  * \copydoc accept(visitor::Visitor&)
30504  */
30505  void accept(visitor::ConstVisitor &v) const override;
30506 
30507  /// \}
30508 
30509 private:
30510  /**
30511  * \brief Set this object as parent for all the children
30512  *
30513  * This should be called in every object (with children) constructor
30514  * to set parents. Since it is called only in the constructors it
30515  * should not be virtual to avoid ambiguities (issue #295).
30516  */
30517  void set_parent_in_children();
30518 };
30519 
30520 /** @} */ // end of ast_class
30521 
30522 } // namespace ast
30523 } // namespace nmodl
30524 #endif // !NMODL_AST_RANGE_HPP
30525 #ifndef NMODL_AST_GLOBAL_HPP
30526 #define NMODL_AST_GLOBAL_HPP
30527 #define NMODL_AST_GLOBAL_HPP_INLINE_DEFINITION_REQUIRED
30528 
30529 namespace nmodl {
30530 namespace ast {
30531 
30532 /**
30533  * @addtogroup ast_class
30534  * @ingroup ast
30535  * @{
30536  */
30537 
30538 /**
30539  * \brief Represents GLOBAL statement in NMODL
30540  *
30541  *
30542  */
30543 class Global : public Statement {
30544 private:
30545  /// Vector of global variables
30547  /// token with location information
30548  std::shared_ptr<ModToken> token;
30549 
30550 public:
30551  /// \name Ctor & dtor
30552  /// \{
30553 
30554  explicit Global(GlobalVarVector variables);
30555  Global(const Global &obj);
30556 
30557  virtual ~Global() = default;
30558 
30559  /// \}
30560 
30561  /**
30562  * \brief Check if the ast node is an instance of ast::Global
30563  * \return true as object is of type ast::Global
30564  */
30565  bool is_global() const noexcept override { return true; }
30566 
30567  /**
30568  * \brief Return a copy of the current node
30569  *
30570  * Recursively make a new copy/clone of the current node including
30571  * all members and return a pointer to the node. This is used for
30572  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
30573  * ast.
30574  *
30575  * @return pointer to the clone/copy of the current node
30576  */
30577  Global *clone() const override { return new Global(*this); }
30578 
30579  /// \name Getters
30580  /// \{
30581 
30582  /**
30583  * \brief Return type (ast::AstNodeType) of ast node
30584  *
30585  * Every node in the ast has a type defined in ast::AstNodeType and this
30586  * function is used to retrieve the same.
30587  *
30588  * \return ast node type i.e. ast::AstNodeType::GLOBAL
30589  *
30590  * \sa Ast::get_node_type_name
30591  */
30592  AstNodeType get_node_type() const noexcept override {
30593  return AstNodeType::GLOBAL;
30594  }
30595 
30596  /**
30597  * \brief Return type (ast::AstNodeType) of ast node as std::string
30598  *
30599  * Every node in the ast has a type defined in ast::AstNodeType.
30600  * This type name can be returned as a std::string for printing
30601  * node to text/json form.
30602  *
30603  * \return name of the node type as a string i.e. "Global"
30604  *
30605  * \sa Ast::get_node_name
30606  */
30607  std::string get_node_type_name() const noexcept override { return "Global"; }
30608 
30609  /**
30610  * \brief Return NMODL statement of ast node as std::string
30611  *
30612  * Every node is related to a special statement in the NMODL. This
30613  * statement can be returned as a std::string for printing to
30614  * text/json form.
30615  *
30616  * \return name of the statement as a string i.e. "GLOBAL "
30617  *
30618  * \sa Ast::get_nmodl_name
30619  */
30620  std::string get_nmodl_name() const noexcept override { return "GLOBAL "; }
30621 
30622  /**
30623  * \brief Get std::shared_ptr from `this` pointer of the current ast node
30624  */
30625  std::shared_ptr<Ast> get_shared_ptr() override {
30626  return std::static_pointer_cast<Global>(shared_from_this());
30627  }
30628 
30629  /**
30630  * \brief Get std::shared_ptr from `this` pointer of the current ast node
30631  */
30632  std::shared_ptr<const Ast> get_shared_ptr() const override {
30633  return std::static_pointer_cast<const Global>(shared_from_this());
30634  }
30635 
30636  /**
30637  * \brief Return associated token for the current ast node
30638  *
30639  * Not all ast nodes have token information. For example,
30640  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
30641  * solution of ODEs. In this case, we return nullptr to store in the
30642  * nmodl::symtab::SymbolTable.
30643  *
30644  * \return pointer to token if exist otherwise nullptr
30645  */
30646  const ModToken *get_token() const noexcept override { return token.get(); }
30647 
30648  /**
30649  * \brief Add member to variables by raw pointer
30650  */
30651  void emplace_back_global_var(GlobalVar *n);
30652 
30653  /**
30654  * \brief Add member to variables by shared_ptr
30655  */
30656  void emplace_back_global_var(std::shared_ptr<GlobalVar> n);
30657 
30658  /**
30659  * \brief Erase member to variables
30660  */
30661  GlobalVarVector::const_iterator
30662  erase_global_var(GlobalVarVector::const_iterator first);
30663 
30664  /**
30665  * \brief Erase members to variables
30666  */
30667  GlobalVarVector::const_iterator
30668  erase_global_var(GlobalVarVector::const_iterator first,
30669  GlobalVarVector::const_iterator last);
30670 
30671  /**
30672  * \brief Erase non-consecutive members to variables
30673  *
30674  * loosely following the cpp reference of remove_if
30675  */
30676  size_t erase_global_var(std::unordered_set<GlobalVar *> &to_be_erased);
30677 
30678  /**
30679  * \brief Insert member to variables
30680  */
30681  GlobalVarVector::const_iterator
30682  insert_global_var(GlobalVarVector::const_iterator position,
30683  const std::shared_ptr<GlobalVar> &n);
30684 
30685  /**
30686  * \brief Insert members to variables
30687  */
30688  template <class NodeType, class InputIterator>
30689  void insert_global_var(GlobalVarVector::const_iterator position, NodeType &to,
30690  InputIterator first, InputIterator last);
30691 
30692  /**
30693  * \brief Reset member to variables
30694  */
30695  void reset_global_var(GlobalVarVector::const_iterator position, GlobalVar *n);
30696 
30697  /**
30698  * \brief Reset member to variables
30699  */
30700  void reset_global_var(GlobalVarVector::const_iterator position,
30701  std::shared_ptr<GlobalVar> n);
30702 
30703  /**
30704  * \brief Getter for member variable \ref Global.variables
30705  */
30706  const GlobalVarVector &get_variables() const noexcept { return variables; }
30707 
30708  /// \}
30709 
30710  /// \name Setters
30711  /// \{
30712 
30713  /**
30714  * \brief Set token for the current ast node
30715  */
30716  void set_token(const ModToken &tok) {
30717  token = std::make_shared<ModToken>(tok);
30718  }
30719 
30720  /**
30721  * \brief Setter for member variable \ref Global.variables (rvalue reference)
30722  */
30723  void set_variables(GlobalVarVector &&variables);
30724 
30725  /**
30726  * \brief Setter for member variable \ref Global.variables
30727  */
30728  void set_variables(const GlobalVarVector &variables);
30729 
30730  /// \}
30731 
30732  /// \name Visitor
30733  /// \{
30734 
30735  /**
30736  * \brief visit children i.e. member variables of current node using provided
30737  * visitor
30738  *
30739  * Different nodes in the AST have different members (i.e. children). This
30740  * method recursively visits children using provided visitor.
30741  *
30742  * \param v Concrete visitor that will be used to recursively visit children
30743  *
30744  * \sa Ast::visit_children for example.
30745  */
30746  void visit_children(visitor::Visitor &v) override;
30747 
30748  /**
30749  * \brief visit children i.e. member variables of current node using provided
30750  * visitor
30751  *
30752  * Different nodes in the AST have different members (i.e. children). This
30753  * method recursively visits children using provided visitor.
30754  *
30755  * \param v Concrete constant visitor that will be used to recursively visit
30756  * children
30757  *
30758  * \sa Ast::visit_children for example.
30759  */
30760  void visit_children(visitor::ConstVisitor &v) const override;
30761 
30762  /**
30763  * \brief accept (or visit) the current AST node using provided visitor
30764  *
30765  * Instead of visiting children of AST node, like Ast::visit_children,
30766  * accept allows to visit the current node itself using provided concrete
30767  * visitor.
30768  *
30769  * \param v Concrete visitor that will be used to recursively visit node
30770  *
30771  * \sa Ast::accept for example.
30772  */
30773  void accept(visitor::Visitor &v) override;
30774 
30775  /**
30776  * \copydoc accept(visitor::Visitor&)
30777  */
30778  void accept(visitor::ConstVisitor &v) const override;
30779 
30780  /// \}
30781 
30782 private:
30783  /**
30784  * \brief Set this object as parent for all the children
30785  *
30786  * This should be called in every object (with children) constructor
30787  * to set parents. Since it is called only in the constructors it
30788  * should not be virtual to avoid ambiguities (issue #295).
30789  */
30790  void set_parent_in_children();
30791 };
30792 
30793 /** @} */ // end of ast_class
30794 
30795 } // namespace ast
30796 } // namespace nmodl
30797 #endif // !NMODL_AST_GLOBAL_HPP
30798 #ifndef NMODL_AST_POINTER_HPP
30799 #define NMODL_AST_POINTER_HPP
30800 
30801 namespace nmodl {
30802 namespace ast {
30803 
30804 /**
30805  * @addtogroup ast_class
30806  * @ingroup ast
30807  * @{
30808  */
30809 
30810 /**
30811  * \brief Represents POINTER statement in NMODL
30812  *
30813  *
30814  */
30815 class Pointer : public Statement {
30816 private:
30817  /// Vector of pointer variables
30819  /// token with location information
30820  std::shared_ptr<ModToken> token;
30821 
30822 public:
30823  /// \name Ctor & dtor
30824  /// \{
30825 
30826  explicit Pointer(PointerVarVector variables);
30827  Pointer(const Pointer &obj);
30828 
30829  virtual ~Pointer() = default;
30830 
30831  /// \}
30832 
30833  /**
30834  * \brief Check if the ast node is an instance of ast::Pointer
30835  * \return true as object is of type ast::Pointer
30836  */
30837  bool is_pointer() const noexcept override { return true; }
30838 
30839  /**
30840  * \brief Return a copy of the current node
30841  *
30842  * Recursively make a new copy/clone of the current node including
30843  * all members and return a pointer to the node. This is used for
30844  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
30845  * ast.
30846  *
30847  * @return pointer to the clone/copy of the current node
30848  */
30849  Pointer *clone() const override { return new Pointer(*this); }
30850 
30851  /// \name Getters
30852  /// \{
30853 
30854  /**
30855  * \brief Return type (ast::AstNodeType) of ast node
30856  *
30857  * Every node in the ast has a type defined in ast::AstNodeType and this
30858  * function is used to retrieve the same.
30859  *
30860  * \return ast node type i.e. ast::AstNodeType::POINTER
30861  *
30862  * \sa Ast::get_node_type_name
30863  */
30864  AstNodeType get_node_type() const noexcept override {
30865  return AstNodeType::POINTER;
30866  }
30867 
30868  /**
30869  * \brief Return type (ast::AstNodeType) of ast node as std::string
30870  *
30871  * Every node in the ast has a type defined in ast::AstNodeType.
30872  * This type name can be returned as a std::string for printing
30873  * node to text/json form.
30874  *
30875  * \return name of the node type as a string i.e. "Pointer"
30876  *
30877  * \sa Ast::get_node_name
30878  */
30879  std::string get_node_type_name() const noexcept override { return "Pointer"; }
30880 
30881  /**
30882  * \brief Return NMODL statement of ast node as std::string
30883  *
30884  * Every node is related to a special statement in the NMODL. This
30885  * statement can be returned as a std::string for printing to
30886  * text/json form.
30887  *
30888  * \return name of the statement as a string i.e. "POINTER "
30889  *
30890  * \sa Ast::get_nmodl_name
30891  */
30892  std::string get_nmodl_name() const noexcept override { return "POINTER "; }
30893 
30894  /**
30895  * \brief Get std::shared_ptr from `this` pointer of the current ast node
30896  */
30897  std::shared_ptr<Ast> get_shared_ptr() override {
30898  return std::static_pointer_cast<Pointer>(shared_from_this());
30899  }
30900 
30901  /**
30902  * \brief Get std::shared_ptr from `this` pointer of the current ast node
30903  */
30904  std::shared_ptr<const Ast> get_shared_ptr() const override {
30905  return std::static_pointer_cast<const Pointer>(shared_from_this());
30906  }
30907 
30908  /**
30909  * \brief Return associated token for the current ast node
30910  *
30911  * Not all ast nodes have token information. For example,
30912  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
30913  * solution of ODEs. In this case, we return nullptr to store in the
30914  * nmodl::symtab::SymbolTable.
30915  *
30916  * \return pointer to token if exist otherwise nullptr
30917  */
30918  const ModToken *get_token() const noexcept override { return token.get(); }
30919 
30920  /**
30921  * \brief Getter for member variable \ref Pointer.variables
30922  */
30923  const PointerVarVector &get_variables() const noexcept { return variables; }
30924 
30925  /// \}
30926 
30927  /// \name Setters
30928  /// \{
30929 
30930  /**
30931  * \brief Set token for the current ast node
30932  */
30933  void set_token(const ModToken &tok) {
30934  token = std::make_shared<ModToken>(tok);
30935  }
30936 
30937  /**
30938  * \brief Setter for member variable \ref Pointer.variables (rvalue reference)
30939  */
30940  void set_variables(PointerVarVector &&variables);
30941 
30942  /**
30943  * \brief Setter for member variable \ref Pointer.variables
30944  */
30945  void set_variables(const PointerVarVector &variables);
30946 
30947  /// \}
30948 
30949  /// \name Visitor
30950  /// \{
30951 
30952  /**
30953  * \brief visit children i.e. member variables of current node using provided
30954  * visitor
30955  *
30956  * Different nodes in the AST have different members (i.e. children). This
30957  * method recursively visits children using provided visitor.
30958  *
30959  * \param v Concrete visitor that will be used to recursively visit children
30960  *
30961  * \sa Ast::visit_children for example.
30962  */
30963  void visit_children(visitor::Visitor &v) override;
30964 
30965  /**
30966  * \brief visit children i.e. member variables of current node using provided
30967  * visitor
30968  *
30969  * Different nodes in the AST have different members (i.e. children). This
30970  * method recursively visits children using provided visitor.
30971  *
30972  * \param v Concrete constant visitor that will be used to recursively visit
30973  * children
30974  *
30975  * \sa Ast::visit_children for example.
30976  */
30977  void visit_children(visitor::ConstVisitor &v) const override;
30978 
30979  /**
30980  * \brief accept (or visit) the current AST node using provided visitor
30981  *
30982  * Instead of visiting children of AST node, like Ast::visit_children,
30983  * accept allows to visit the current node itself using provided concrete
30984  * visitor.
30985  *
30986  * \param v Concrete visitor that will be used to recursively visit node
30987  *
30988  * \sa Ast::accept for example.
30989  */
30990  void accept(visitor::Visitor &v) override;
30991 
30992  /**
30993  * \copydoc accept(visitor::Visitor&)
30994  */
30995  void accept(visitor::ConstVisitor &v) const override;
30996 
30997  /// \}
30998 
30999 private:
31000  /**
31001  * \brief Set this object as parent for all the children
31002  *
31003  * This should be called in every object (with children) constructor
31004  * to set parents. Since it is called only in the constructors it
31005  * should not be virtual to avoid ambiguities (issue #295).
31006  */
31007  void set_parent_in_children();
31008 };
31009 
31010 /** @} */ // end of ast_class
31011 
31012 } // namespace ast
31013 } // namespace nmodl
31014 #endif // !NMODL_AST_POINTER_HPP
31015 #ifndef NMODL_AST_BBCORE_POINTER_HPP
31016 #define NMODL_AST_BBCORE_POINTER_HPP
31017 
31018 namespace nmodl {
31019 namespace ast {
31020 
31021 /**
31022  * @addtogroup ast_class
31023  * @ingroup ast
31024  * @{
31025  */
31026 
31027 /**
31028  * \brief Represents BBCOREPOINTER statement in NMODL
31029  *
31030  * Here is an example of BBCOREPOINTER statement:
31031  *
31032  * \code{.mod}
31033  * NEURON {
31034  * THREADSAFE
31035  * POINT_PROCESS ProbAMPANMDA_EMS
31036  * BBCOREPOINTER rng, data
31037  * \endcode
31038  *
31039  */
31040 class BbcorePointer : public Statement {
31041 private:
31042  /// Vector of bbcore pointer variables
31044  /// token with location information
31045  std::shared_ptr<ModToken> token;
31046 
31047 public:
31048  /// \name Ctor & dtor
31049  /// \{
31050 
31051  explicit BbcorePointer(BbcorePointerVarVector variables);
31052  BbcorePointer(const BbcorePointer &obj);
31053 
31054  virtual ~BbcorePointer() = default;
31055 
31056  /// \}
31057 
31058  /**
31059  * \brief Check if the ast node is an instance of ast::BbcorePointer
31060  * \return true as object is of type ast::BbcorePointer
31061  */
31062  bool is_bbcore_pointer() const noexcept override { return true; }
31063 
31064  /**
31065  * \brief Return a copy of the current node
31066  *
31067  * Recursively make a new copy/clone of the current node including
31068  * all members and return a pointer to the node. This is used for
31069  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
31070  * ast.
31071  *
31072  * @return pointer to the clone/copy of the current node
31073  */
31074  BbcorePointer *clone() const override { return new BbcorePointer(*this); }
31075 
31076  /// \name Getters
31077  /// \{
31078 
31079  /**
31080  * \brief Return type (ast::AstNodeType) of ast node
31081  *
31082  * Every node in the ast has a type defined in ast::AstNodeType and this
31083  * function is used to retrieve the same.
31084  *
31085  * \return ast node type i.e. ast::AstNodeType::BBCORE_POINTER
31086  *
31087  * \sa Ast::get_node_type_name
31088  */
31089  AstNodeType get_node_type() const noexcept override {
31091  }
31092 
31093  /**
31094  * \brief Return type (ast::AstNodeType) of ast node as std::string
31095  *
31096  * Every node in the ast has a type defined in ast::AstNodeType.
31097  * This type name can be returned as a std::string for printing
31098  * node to text/json form.
31099  *
31100  * \return name of the node type as a string i.e. "BbcorePointer"
31101  *
31102  * \sa Ast::get_node_name
31103  */
31104  std::string get_node_type_name() const noexcept override {
31105  return "BbcorePointer";
31106  }
31107 
31108  /**
31109  * \brief Return NMODL statement of ast node as std::string
31110  *
31111  * Every node is related to a special statement in the NMODL. This
31112  * statement can be returned as a std::string for printing to
31113  * text/json form.
31114  *
31115  * \return name of the statement as a string i.e. "BBCOREPOINTER "
31116  *
31117  * \sa Ast::get_nmodl_name
31118  */
31119  std::string get_nmodl_name() const noexcept override {
31120  return "BBCOREPOINTER ";
31121  }
31122 
31123  /**
31124  * \brief Get std::shared_ptr from `this` pointer of the current ast node
31125  */
31126  std::shared_ptr<Ast> get_shared_ptr() override {
31127  return std::static_pointer_cast<BbcorePointer>(shared_from_this());
31128  }
31129 
31130  /**
31131  * \brief Get std::shared_ptr from `this` pointer of the current ast node
31132  */
31133  std::shared_ptr<const Ast> get_shared_ptr() const override {
31134  return std::static_pointer_cast<const BbcorePointer>(shared_from_this());
31135  }
31136 
31137  /**
31138  * \brief Return associated token for the current ast node
31139  *
31140  * Not all ast nodes have token information. For example,
31141  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
31142  * solution of ODEs. In this case, we return nullptr to store in the
31143  * nmodl::symtab::SymbolTable.
31144  *
31145  * \return pointer to token if exist otherwise nullptr
31146  */
31147  const ModToken *get_token() const noexcept override { return token.get(); }
31148 
31149  /**
31150  * \brief Getter for member variable \ref BbcorePointer.variables
31151  */
31152  const BbcorePointerVarVector &get_variables() const noexcept {
31153  return variables;
31154  }
31155 
31156  /// \}
31157 
31158  /// \name Setters
31159  /// \{
31160 
31161  /**
31162  * \brief Set token for the current ast node
31163  */
31164  void set_token(const ModToken &tok) {
31165  token = std::make_shared<ModToken>(tok);
31166  }
31167 
31168  /**
31169  * \brief Setter for member variable \ref BbcorePointer.variables (rvalue
31170  * reference)
31171  */
31172  void set_variables(BbcorePointerVarVector &&variables);
31173 
31174  /**
31175  * \brief Setter for member variable \ref BbcorePointer.variables
31176  */
31177  void set_variables(const BbcorePointerVarVector &variables);
31178 
31179  /// \}
31180 
31181  /// \name Visitor
31182  /// \{
31183 
31184  /**
31185  * \brief visit children i.e. member variables of current node using provided
31186  * visitor
31187  *
31188  * Different nodes in the AST have different members (i.e. children). This
31189  * method recursively visits children using provided visitor.
31190  *
31191  * \param v Concrete visitor that will be used to recursively visit children
31192  *
31193  * \sa Ast::visit_children for example.
31194  */
31195  void visit_children(visitor::Visitor &v) override;
31196 
31197  /**
31198  * \brief visit children i.e. member variables of current node using provided
31199  * visitor
31200  *
31201  * Different nodes in the AST have different members (i.e. children). This
31202  * method recursively visits children using provided visitor.
31203  *
31204  * \param v Concrete constant visitor that will be used to recursively visit
31205  * children
31206  *
31207  * \sa Ast::visit_children for example.
31208  */
31209  void visit_children(visitor::ConstVisitor &v) const override;
31210 
31211  /**
31212  * \brief accept (or visit) the current AST node using provided visitor
31213  *
31214  * Instead of visiting children of AST node, like Ast::visit_children,
31215  * accept allows to visit the current node itself using provided concrete
31216  * visitor.
31217  *
31218  * \param v Concrete visitor that will be used to recursively visit node
31219  *
31220  * \sa Ast::accept for example.
31221  */
31222  void accept(visitor::Visitor &v) override;
31223 
31224  /**
31225  * \copydoc accept(visitor::Visitor&)
31226  */
31227  void accept(visitor::ConstVisitor &v) const override;
31228 
31229  /// \}
31230 
31231 private:
31232  /**
31233  * \brief Set this object as parent for all the children
31234  *
31235  * This should be called in every object (with children) constructor
31236  * to set parents. Since it is called only in the constructors it
31237  * should not be virtual to avoid ambiguities (issue #295).
31238  */
31239  void set_parent_in_children();
31240 };
31241 
31242 /** @} */ // end of ast_class
31243 
31244 } // namespace ast
31245 } // namespace nmodl
31246 #endif // !NMODL_AST_BBCORE_POINTER_HPP
31247 #ifndef NMODL_AST_EXTERNAL_HPP
31248 #define NMODL_AST_EXTERNAL_HPP
31249 
31250 namespace nmodl {
31251 namespace ast {
31252 
31253 /**
31254  * @addtogroup ast_class
31255  * @ingroup ast
31256  * @{
31257  */
31258 
31259 /**
31260  * \brief Represents EXTERNAL statement in NMODL
31261  *
31262  *
31263  */
31264 class External : public Statement {
31265 private:
31266  /// Vector of external variables
31268  /// token with location information
31269  std::shared_ptr<ModToken> token;
31270 
31271 public:
31272  /// \name Ctor & dtor
31273  /// \{
31274 
31275  explicit External(ExternVarVector variables);
31276  External(const External &obj);
31277 
31278  virtual ~External() = default;
31279 
31280  /// \}
31281 
31282  /**
31283  * \brief Check if the ast node is an instance of ast::External
31284  * \return true as object is of type ast::External
31285  */
31286  bool is_external() const noexcept override { return true; }
31287 
31288  /**
31289  * \brief Return a copy of the current node
31290  *
31291  * Recursively make a new copy/clone of the current node including
31292  * all members and return a pointer to the node. This is used for
31293  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
31294  * ast.
31295  *
31296  * @return pointer to the clone/copy of the current node
31297  */
31298  External *clone() const override { return new External(*this); }
31299 
31300  /// \name Getters
31301  /// \{
31302 
31303  /**
31304  * \brief Return type (ast::AstNodeType) of ast node
31305  *
31306  * Every node in the ast has a type defined in ast::AstNodeType and this
31307  * function is used to retrieve the same.
31308  *
31309  * \return ast node type i.e. ast::AstNodeType::EXTERNAL
31310  *
31311  * \sa Ast::get_node_type_name
31312  */
31313  AstNodeType get_node_type() const noexcept override {
31314  return AstNodeType::EXTERNAL;
31315  }
31316 
31317  /**
31318  * \brief Return type (ast::AstNodeType) of ast node as std::string
31319  *
31320  * Every node in the ast has a type defined in ast::AstNodeType.
31321  * This type name can be returned as a std::string for printing
31322  * node to text/json form.
31323  *
31324  * \return name of the node type as a string i.e. "External"
31325  *
31326  * \sa Ast::get_node_name
31327  */
31328  std::string get_node_type_name() const noexcept override {
31329  return "External";
31330  }
31331 
31332  /**
31333  * \brief Return NMODL statement of ast node as std::string
31334  *
31335  * Every node is related to a special statement in the NMODL. This
31336  * statement can be returned as a std::string for printing to
31337  * text/json form.
31338  *
31339  * \return name of the statement as a string i.e. "EXTERNAL "
31340  *
31341  * \sa Ast::get_nmodl_name
31342  */
31343  std::string get_nmodl_name() const noexcept override { return "EXTERNAL "; }
31344 
31345  /**
31346  * \brief Get std::shared_ptr from `this` pointer of the current ast node
31347  */
31348  std::shared_ptr<Ast> get_shared_ptr() override {
31349  return std::static_pointer_cast<External>(shared_from_this());
31350  }
31351 
31352  /**
31353  * \brief Get std::shared_ptr from `this` pointer of the current ast node
31354  */
31355  std::shared_ptr<const Ast> get_shared_ptr() const override {
31356  return std::static_pointer_cast<const External>(shared_from_this());
31357  }
31358 
31359  /**
31360  * \brief Return associated token for the current ast node
31361  *
31362  * Not all ast nodes have token information. For example,
31363  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
31364  * solution of ODEs. In this case, we return nullptr to store in the
31365  * nmodl::symtab::SymbolTable.
31366  *
31367  * \return pointer to token if exist otherwise nullptr
31368  */
31369  const ModToken *get_token() const noexcept override { return token.get(); }
31370 
31371  /**
31372  * \brief Getter for member variable \ref External.variables
31373  */
31374  const ExternVarVector &get_variables() const noexcept { return variables; }
31375 
31376  /// \}
31377 
31378  /// \name Setters
31379  /// \{
31380 
31381  /**
31382  * \brief Set token for the current ast node
31383  */
31384  void set_token(const ModToken &tok) {
31385  token = std::make_shared<ModToken>(tok);
31386  }
31387 
31388  /**
31389  * \brief Setter for member variable \ref External.variables (rvalue
31390  * reference)
31391  */
31392  void set_variables(ExternVarVector &&variables);
31393 
31394  /**
31395  * \brief Setter for member variable \ref External.variables
31396  */
31397  void set_variables(const ExternVarVector &variables);
31398 
31399  /// \}
31400 
31401  /// \name Visitor
31402  /// \{
31403 
31404  /**
31405  * \brief visit children i.e. member variables of current node using provided
31406  * visitor
31407  *
31408  * Different nodes in the AST have different members (i.e. children). This
31409  * method recursively visits children using provided visitor.
31410  *
31411  * \param v Concrete visitor that will be used to recursively visit children
31412  *
31413  * \sa Ast::visit_children for example.
31414  */
31415  void visit_children(visitor::Visitor &v) override;
31416 
31417  /**
31418  * \brief visit children i.e. member variables of current node using provided
31419  * visitor
31420  *
31421  * Different nodes in the AST have different members (i.e. children). This
31422  * method recursively visits children using provided visitor.
31423  *
31424  * \param v Concrete constant visitor that will be used to recursively visit
31425  * children
31426  *
31427  * \sa Ast::visit_children for example.
31428  */
31429  void visit_children(visitor::ConstVisitor &v) const override;
31430 
31431  /**
31432  * \brief accept (or visit) the current AST node using provided visitor
31433  *
31434  * Instead of visiting children of AST node, like Ast::visit_children,
31435  * accept allows to visit the current node itself using provided concrete
31436  * visitor.
31437  *
31438  * \param v Concrete visitor that will be used to recursively visit node
31439  *
31440  * \sa Ast::accept for example.
31441  */
31442  void accept(visitor::Visitor &v) override;
31443 
31444  /**
31445  * \copydoc accept(visitor::Visitor&)
31446  */
31447  void accept(visitor::ConstVisitor &v) const override;
31448 
31449  /// \}
31450 
31451 private:
31452  /**
31453  * \brief Set this object as parent for all the children
31454  *
31455  * This should be called in every object (with children) constructor
31456  * to set parents. Since it is called only in the constructors it
31457  * should not be virtual to avoid ambiguities (issue #295).
31458  */
31459  void set_parent_in_children();
31460 };
31461 
31462 /** @} */ // end of ast_class
31463 
31464 } // namespace ast
31465 } // namespace nmodl
31466 #endif // !NMODL_AST_EXTERNAL_HPP
31467 #ifndef NMODL_AST_THREAD_SAFE_HPP
31468 #define NMODL_AST_THREAD_SAFE_HPP
31469 
31470 namespace nmodl {
31471 namespace ast {
31472 
31473 /**
31474  * @addtogroup ast_class
31475  * @ingroup ast
31476  * @{
31477  */
31478 
31479 /**
31480  * \brief Represents THREADSAFE statement in NMODL
31481  *
31482  *
31483  */
31484 class ThreadSafe : public Statement {
31485 private:
31486  /// Vector of thread safe variables
31488  /// token with location information
31489  std::shared_ptr<ModToken> token;
31490 
31491 public:
31492  /// \name Ctor & dtor
31493  /// \{
31494 
31495  explicit ThreadSafe(ThreadsafeVarVector variables);
31496  ThreadSafe(const ThreadSafe &obj);
31497 
31498  virtual ~ThreadSafe() = default;
31499 
31500  /// \}
31501 
31502  /**
31503  * \brief Check if the ast node is an instance of ast::ThreadSafe
31504  * \return true as object is of type ast::ThreadSafe
31505  */
31506  bool is_thread_safe() const noexcept override { return true; }
31507 
31508  /**
31509  * \brief Return a copy of the current node
31510  *
31511  * Recursively make a new copy/clone of the current node including
31512  * all members and return a pointer to the node. This is used for
31513  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
31514  * ast.
31515  *
31516  * @return pointer to the clone/copy of the current node
31517  */
31518  ThreadSafe *clone() const override { return new ThreadSafe(*this); }
31519 
31520  /// \name Getters
31521  /// \{
31522 
31523  /**
31524  * \brief Return type (ast::AstNodeType) of ast node
31525  *
31526  * Every node in the ast has a type defined in ast::AstNodeType and this
31527  * function is used to retrieve the same.
31528  *
31529  * \return ast node type i.e. ast::AstNodeType::THREAD_SAFE
31530  *
31531  * \sa Ast::get_node_type_name
31532  */
31533  AstNodeType get_node_type() const noexcept override {
31534  return AstNodeType::THREAD_SAFE;
31535  }
31536 
31537  /**
31538  * \brief Return type (ast::AstNodeType) of ast node as std::string
31539  *
31540  * Every node in the ast has a type defined in ast::AstNodeType.
31541  * This type name can be returned as a std::string for printing
31542  * node to text/json form.
31543  *
31544  * \return name of the node type as a string i.e. "ThreadSafe"
31545  *
31546  * \sa Ast::get_node_name
31547  */
31548  std::string get_node_type_name() const noexcept override {
31549  return "ThreadSafe";
31550  }
31551 
31552  /**
31553  * \brief Return NMODL statement of ast node as std::string
31554  *
31555  * Every node is related to a special statement in the NMODL. This
31556  * statement can be returned as a std::string for printing to
31557  * text/json form.
31558  *
31559  * \return name of the statement as a string i.e. "THREADSAFE"
31560  *
31561  * \sa Ast::get_nmodl_name
31562  */
31563  std::string get_nmodl_name() const noexcept override { return "THREADSAFE"; }
31564 
31565  /**
31566  * \brief Get std::shared_ptr from `this` pointer of the current ast node
31567  */
31568  std::shared_ptr<Ast> get_shared_ptr() override {
31569  return std::static_pointer_cast<ThreadSafe>(shared_from_this());
31570  }
31571 
31572  /**
31573  * \brief Get std::shared_ptr from `this` pointer of the current ast node
31574  */
31575  std::shared_ptr<const Ast> get_shared_ptr() const override {
31576  return std::static_pointer_cast<const ThreadSafe>(shared_from_this());
31577  }
31578 
31579  /**
31580  * \brief Return associated token for the current ast node
31581  *
31582  * Not all ast nodes have token information. For example,
31583  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
31584  * solution of ODEs. In this case, we return nullptr to store in the
31585  * nmodl::symtab::SymbolTable.
31586  *
31587  * \return pointer to token if exist otherwise nullptr
31588  */
31589  const ModToken *get_token() const noexcept override { return token.get(); }
31590 
31591  /**
31592  * \brief Getter for member variable \ref ThreadSafe.variables
31593  */
31594  const ThreadsafeVarVector &get_variables() const noexcept {
31595  return variables;
31596  }
31597 
31598  /// \}
31599 
31600  /// \name Setters
31601  /// \{
31602 
31603  /**
31604  * \brief Set token for the current ast node
31605  */
31606  void set_token(const ModToken &tok) {
31607  token = std::make_shared<ModToken>(tok);
31608  }
31609 
31610  /**
31611  * \brief Setter for member variable \ref ThreadSafe.variables (rvalue
31612  * reference)
31613  */
31614  void set_variables(ThreadsafeVarVector &&variables);
31615 
31616  /**
31617  * \brief Setter for member variable \ref ThreadSafe.variables
31618  */
31619  void set_variables(const ThreadsafeVarVector &variables);
31620 
31621  /// \}
31622 
31623  /// \name Visitor
31624  /// \{
31625 
31626  /**
31627  * \brief visit children i.e. member variables of current node using provided
31628  * visitor
31629  *
31630  * Different nodes in the AST have different members (i.e. children). This
31631  * method recursively visits children using provided visitor.
31632  *
31633  * \param v Concrete visitor that will be used to recursively visit children
31634  *
31635  * \sa Ast::visit_children for example.
31636  */
31637  void visit_children(visitor::Visitor &v) override;
31638 
31639  /**
31640  * \brief visit children i.e. member variables of current node using provided
31641  * visitor
31642  *
31643  * Different nodes in the AST have different members (i.e. children). This
31644  * method recursively visits children using provided visitor.
31645  *
31646  * \param v Concrete constant visitor that will be used to recursively visit
31647  * children
31648  *
31649  * \sa Ast::visit_children for example.
31650  */
31651  void visit_children(visitor::ConstVisitor &v) const override;
31652 
31653  /**
31654  * \brief accept (or visit) the current AST node using provided visitor
31655  *
31656  * Instead of visiting children of AST node, like Ast::visit_children,
31657  * accept allows to visit the current node itself using provided concrete
31658  * visitor.
31659  *
31660  * \param v Concrete visitor that will be used to recursively visit node
31661  *
31662  * \sa Ast::accept for example.
31663  */
31664  void accept(visitor::Visitor &v) override;
31665 
31666  /**
31667  * \copydoc accept(visitor::Visitor&)
31668  */
31669  void accept(visitor::ConstVisitor &v) const override;
31670 
31671  /// \}
31672 
31673 private:
31674  /**
31675  * \brief Set this object as parent for all the children
31676  *
31677  * This should be called in every object (with children) constructor
31678  * to set parents. Since it is called only in the constructors it
31679  * should not be virtual to avoid ambiguities (issue #295).
31680  */
31681  void set_parent_in_children();
31682 };
31683 
31684 /** @} */ // end of ast_class
31685 
31686 } // namespace ast
31687 } // namespace nmodl
31688 #endif // !NMODL_AST_THREAD_SAFE_HPP
31689 #ifndef NMODL_AST_VERBATIM_HPP
31690 #define NMODL_AST_VERBATIM_HPP
31691 
31692 namespace nmodl {
31693 namespace ast {
31694 
31695 /**
31696  * @addtogroup ast_class
31697  * @ingroup ast
31698  * @{
31699  */
31700 
31701 /**
31702  * \brief Represents a C code block
31703  *
31704  *
31705  */
31706 class Verbatim : public Statement {
31707 private:
31708  /// C code as a string
31709  std::shared_ptr<String> statement;
31710  /// token with location information
31711  std::shared_ptr<ModToken> token;
31712 
31713 public:
31714  /// \name Ctor & dtor
31715  /// \{
31716 
31717  explicit Verbatim(String *statement);
31718  explicit Verbatim(const std::shared_ptr<String> &statement);
31719  Verbatim(const Verbatim &obj);
31720 
31721  virtual ~Verbatim() = default;
31722 
31723  /// \}
31724 
31725  /**
31726  * \brief Check if the ast node is an instance of ast::Verbatim
31727  * \return true as object is of type ast::Verbatim
31728  */
31729  bool is_verbatim() const noexcept override { return true; }
31730 
31731  /**
31732  * \brief Return a copy of the current node
31733  *
31734  * Recursively make a new copy/clone of the current node including
31735  * all members and return a pointer to the node. This is used for
31736  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
31737  * ast.
31738  *
31739  * @return pointer to the clone/copy of the current node
31740  */
31741  Verbatim *clone() const override { return new Verbatim(*this); }
31742 
31743  /// \name Getters
31744  /// \{
31745 
31746  /**
31747  * \brief Return type (ast::AstNodeType) of ast node
31748  *
31749  * Every node in the ast has a type defined in ast::AstNodeType and this
31750  * function is used to retrieve the same.
31751  *
31752  * \return ast node type i.e. ast::AstNodeType::VERBATIM
31753  *
31754  * \sa Ast::get_node_type_name
31755  */
31756  AstNodeType get_node_type() const noexcept override {
31757  return AstNodeType::VERBATIM;
31758  }
31759 
31760  /**
31761  * \brief Return type (ast::AstNodeType) of ast node as std::string
31762  *
31763  * Every node in the ast has a type defined in ast::AstNodeType.
31764  * This type name can be returned as a std::string for printing
31765  * node to text/json form.
31766  *
31767  * \return name of the node type as a string i.e. "Verbatim"
31768  *
31769  * \sa Ast::get_node_name
31770  */
31771  std::string get_node_type_name() const noexcept override {
31772  return "Verbatim";
31773  }
31774 
31775  /**
31776  * \brief Return NMODL statement of ast node as std::string
31777  *
31778  * Every node is related to a special statement in the NMODL. This
31779  * statement can be returned as a std::string for printing to
31780  * text/json form.
31781  *
31782  * \return name of the statement as a string i.e. "VERBATIM"
31783  *
31784  * \sa Ast::get_nmodl_name
31785  */
31786  std::string get_nmodl_name() const noexcept override { return "VERBATIM"; }
31787 
31788  /**
31789  * \brief Get std::shared_ptr from `this` pointer of the current ast node
31790  */
31791  std::shared_ptr<Ast> get_shared_ptr() override {
31792  return std::static_pointer_cast<Verbatim>(shared_from_this());
31793  }
31794 
31795  /**
31796  * \brief Get std::shared_ptr from `this` pointer of the current ast node
31797  */
31798  std::shared_ptr<const Ast> get_shared_ptr() const override {
31799  return std::static_pointer_cast<const Verbatim>(shared_from_this());
31800  }
31801 
31802  /**
31803  * \brief Return associated token for the current ast node
31804  *
31805  * Not all ast nodes have token information. For example,
31806  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
31807  * solution of ODEs. In this case, we return nullptr to store in the
31808  * nmodl::symtab::SymbolTable.
31809  *
31810  * \return pointer to token if exist otherwise nullptr
31811  */
31812  const ModToken *get_token() const noexcept override { return token.get(); }
31813 
31814  /**
31815  * \brief Getter for member variable \ref Verbatim.statement
31816  */
31817  const std::shared_ptr<String> &get_statement() const noexcept {
31818  return statement;
31819  }
31820 
31821  /// \}
31822 
31823  /// \name Setters
31824  /// \{
31825 
31826  /**
31827  * \brief Set token for the current ast node
31828  */
31829  void set_token(const ModToken &tok) {
31830  token = std::make_shared<ModToken>(tok);
31831  }
31832 
31833  /**
31834  * \brief Setter for member variable \ref Verbatim.statement (rvalue
31835  * reference)
31836  */
31837  void set_statement(std::shared_ptr<String> &&statement);
31838 
31839  /**
31840  * \brief Setter for member variable \ref Verbatim.statement
31841  */
31842  void set_statement(const std::shared_ptr<String> &statement);
31843 
31844  /// \}
31845 
31846  /// \name Visitor
31847  /// \{
31848 
31849  /**
31850  * \brief visit children i.e. member variables of current node using provided
31851  * visitor
31852  *
31853  * Different nodes in the AST have different members (i.e. children). This
31854  * method recursively visits children using provided visitor.
31855  *
31856  * \param v Concrete visitor that will be used to recursively visit children
31857  *
31858  * \sa Ast::visit_children for example.
31859  */
31860  void visit_children(visitor::Visitor &v) override;
31861 
31862  /**
31863  * \brief visit children i.e. member variables of current node using provided
31864  * visitor
31865  *
31866  * Different nodes in the AST have different members (i.e. children). This
31867  * method recursively visits children using provided visitor.
31868  *
31869  * \param v Concrete constant visitor that will be used to recursively visit
31870  * children
31871  *
31872  * \sa Ast::visit_children for example.
31873  */
31874  void visit_children(visitor::ConstVisitor &v) const override;
31875 
31876  /**
31877  * \brief accept (or visit) the current AST node using provided visitor
31878  *
31879  * Instead of visiting children of AST node, like Ast::visit_children,
31880  * accept allows to visit the current node itself using provided concrete
31881  * visitor.
31882  *
31883  * \param v Concrete visitor that will be used to recursively visit node
31884  *
31885  * \sa Ast::accept for example.
31886  */
31887  void accept(visitor::Visitor &v) override;
31888 
31889  /**
31890  * \copydoc accept(visitor::Visitor&)
31891  */
31892  void accept(visitor::ConstVisitor &v) const override;
31893 
31894  /// \}
31895 
31896 private:
31897  /**
31898  * \brief Set this object as parent for all the children
31899  *
31900  * This should be called in every object (with children) constructor
31901  * to set parents. Since it is called only in the constructors it
31902  * should not be virtual to avoid ambiguities (issue #295).
31903  */
31904  void set_parent_in_children();
31905 };
31906 
31907 /** @} */ // end of ast_class
31908 
31909 } // namespace ast
31910 } // namespace nmodl
31911 #endif // !NMODL_AST_VERBATIM_HPP
31912 #ifndef NMODL_AST_LINE_COMMENT_HPP
31913 #define NMODL_AST_LINE_COMMENT_HPP
31914 
31915 namespace nmodl {
31916 namespace ast {
31917 
31918 /**
31919  * @addtogroup ast_class
31920  * @ingroup ast
31921  * @{
31922  */
31923 
31924 /**
31925  * \brief Represents a one line comment in NMODL
31926  *
31927  *
31928  */
31929 class LineComment : public Statement {
31930 private:
31931  /// comment text
31932  std::shared_ptr<String> statement;
31933  /// token with location information
31934  std::shared_ptr<ModToken> token;
31935 
31936 public:
31937  /// \name Ctor & dtor
31938  /// \{
31939 
31940  explicit LineComment(String *statement);
31941  explicit LineComment(const std::shared_ptr<String> &statement);
31942  LineComment(const LineComment &obj);
31943 
31944  virtual ~LineComment() = default;
31945 
31946  /// \}
31947 
31948  /**
31949  * \brief Check if the ast node is an instance of ast::LineComment
31950  * \return true as object is of type ast::LineComment
31951  */
31952  bool is_line_comment() const noexcept override { return true; }
31953 
31954  /**
31955  * \brief Return a copy of the current node
31956  *
31957  * Recursively make a new copy/clone of the current node including
31958  * all members and return a pointer to the node. This is used for
31959  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
31960  * ast.
31961  *
31962  * @return pointer to the clone/copy of the current node
31963  */
31964  LineComment *clone() const override { return new LineComment(*this); }
31965 
31966  /// \name Getters
31967  /// \{
31968 
31969  /**
31970  * \brief Return type (ast::AstNodeType) of ast node
31971  *
31972  * Every node in the ast has a type defined in ast::AstNodeType and this
31973  * function is used to retrieve the same.
31974  *
31975  * \return ast node type i.e. ast::AstNodeType::LINE_COMMENT
31976  *
31977  * \sa Ast::get_node_type_name
31978  */
31979  AstNodeType get_node_type() const noexcept override {
31981  }
31982 
31983  /**
31984  * \brief Return type (ast::AstNodeType) of ast node as std::string
31985  *
31986  * Every node in the ast has a type defined in ast::AstNodeType.
31987  * This type name can be returned as a std::string for printing
31988  * node to text/json form.
31989  *
31990  * \return name of the node type as a string i.e. "LineComment"
31991  *
31992  * \sa Ast::get_node_name
31993  */
31994  std::string get_node_type_name() const noexcept override {
31995  return "LineComment";
31996  }
31997 
31998  /**
31999  * \brief Get std::shared_ptr from `this` pointer of the current ast node
32000  */
32001  std::shared_ptr<Ast> get_shared_ptr() override {
32002  return std::static_pointer_cast<LineComment>(shared_from_this());
32003  }
32004 
32005  /**
32006  * \brief Get std::shared_ptr from `this` pointer of the current ast node
32007  */
32008  std::shared_ptr<const Ast> get_shared_ptr() const override {
32009  return std::static_pointer_cast<const LineComment>(shared_from_this());
32010  }
32011 
32012  /**
32013  * \brief Return associated token for the current ast node
32014  *
32015  * Not all ast nodes have token information. For example,
32016  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
32017  * solution of ODEs. In this case, we return nullptr to store in the
32018  * nmodl::symtab::SymbolTable.
32019  *
32020  * \return pointer to token if exist otherwise nullptr
32021  */
32022  const ModToken *get_token() const noexcept override { return token.get(); }
32023 
32024  /**
32025  * \brief Getter for member variable \ref LineComment.statement
32026  */
32027  const std::shared_ptr<String> &get_statement() const noexcept {
32028  return statement;
32029  }
32030 
32031  /// \}
32032 
32033  /// \name Setters
32034  /// \{
32035 
32036  /**
32037  * \brief Set token for the current ast node
32038  */
32039  void set_token(const ModToken &tok) {
32040  token = std::make_shared<ModToken>(tok);
32041  }
32042 
32043  /**
32044  * \brief Setter for member variable \ref LineComment.statement (rvalue
32045  * reference)
32046  */
32047  void set_statement(std::shared_ptr<String> &&statement);
32048 
32049  /**
32050  * \brief Setter for member variable \ref LineComment.statement
32051  */
32052  void set_statement(const std::shared_ptr<String> &statement);
32053 
32054  /// \}
32055 
32056  /// \name Visitor
32057  /// \{
32058 
32059  /**
32060  * \brief visit children i.e. member variables of current node using provided
32061  * visitor
32062  *
32063  * Different nodes in the AST have different members (i.e. children). This
32064  * method recursively visits children using provided visitor.
32065  *
32066  * \param v Concrete visitor that will be used to recursively visit children
32067  *
32068  * \sa Ast::visit_children for example.
32069  */
32070  void visit_children(visitor::Visitor &v) override;
32071 
32072  /**
32073  * \brief visit children i.e. member variables of current node using provided
32074  * visitor
32075  *
32076  * Different nodes in the AST have different members (i.e. children). This
32077  * method recursively visits children using provided visitor.
32078  *
32079  * \param v Concrete constant visitor that will be used to recursively visit
32080  * children
32081  *
32082  * \sa Ast::visit_children for example.
32083  */
32084  void visit_children(visitor::ConstVisitor &v) const override;
32085 
32086  /**
32087  * \brief accept (or visit) the current AST node using provided visitor
32088  *
32089  * Instead of visiting children of AST node, like Ast::visit_children,
32090  * accept allows to visit the current node itself using provided concrete
32091  * visitor.
32092  *
32093  * \param v Concrete visitor that will be used to recursively visit node
32094  *
32095  * \sa Ast::accept for example.
32096  */
32097  void accept(visitor::Visitor &v) override;
32098 
32099  /**
32100  * \copydoc accept(visitor::Visitor&)
32101  */
32102  void accept(visitor::ConstVisitor &v) const override;
32103 
32104  /// \}
32105 
32106 private:
32107  /**
32108  * \brief Set this object as parent for all the children
32109  *
32110  * This should be called in every object (with children) constructor
32111  * to set parents. Since it is called only in the constructors it
32112  * should not be virtual to avoid ambiguities (issue #295).
32113  */
32114  void set_parent_in_children();
32115 };
32116 
32117 /** @} */ // end of ast_class
32118 
32119 } // namespace ast
32120 } // namespace nmodl
32121 #endif // !NMODL_AST_LINE_COMMENT_HPP
32122 #ifndef NMODL_AST_BLOCK_COMMENT_HPP
32123 #define NMODL_AST_BLOCK_COMMENT_HPP
32124 
32125 namespace nmodl {
32126 namespace ast {
32127 
32128 /**
32129  * @addtogroup ast_class
32130  * @ingroup ast
32131  * @{
32132  */
32133 
32134 /**
32135  * \brief Represents a multi-line comment in NMODL
32136  *
32137  *
32138  */
32139 class BlockComment : public Statement {
32140 private:
32141  /// comment text
32142  std::shared_ptr<String> statement;
32143  /// token with location information
32144  std::shared_ptr<ModToken> token;
32145 
32146 public:
32147  /// \name Ctor & dtor
32148  /// \{
32149 
32150  explicit BlockComment(String *statement);
32151  explicit BlockComment(const std::shared_ptr<String> &statement);
32152  BlockComment(const BlockComment &obj);
32153 
32154  virtual ~BlockComment() = default;
32155 
32156  /// \}
32157 
32158  /**
32159  * \brief Check if the ast node is an instance of ast::BlockComment
32160  * \return true as object is of type ast::BlockComment
32161  */
32162  bool is_block_comment() const noexcept override { return true; }
32163 
32164  /**
32165  * \brief Return a copy of the current node
32166  *
32167  * Recursively make a new copy/clone of the current node including
32168  * all members and return a pointer to the node. This is used for
32169  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
32170  * ast.
32171  *
32172  * @return pointer to the clone/copy of the current node
32173  */
32174  BlockComment *clone() const override { return new BlockComment(*this); }
32175 
32176  /// \name Getters
32177  /// \{
32178 
32179  /**
32180  * \brief Return type (ast::AstNodeType) of ast node
32181  *
32182  * Every node in the ast has a type defined in ast::AstNodeType and this
32183  * function is used to retrieve the same.
32184  *
32185  * \return ast node type i.e. ast::AstNodeType::BLOCK_COMMENT
32186  *
32187  * \sa Ast::get_node_type_name
32188  */
32189  AstNodeType get_node_type() const noexcept override {
32191  }
32192 
32193  /**
32194  * \brief Return type (ast::AstNodeType) of ast node as std::string
32195  *
32196  * Every node in the ast has a type defined in ast::AstNodeType.
32197  * This type name can be returned as a std::string for printing
32198  * node to text/json form.
32199  *
32200  * \return name of the node type as a string i.e. "BlockComment"
32201  *
32202  * \sa Ast::get_node_name
32203  */
32204  std::string get_node_type_name() const noexcept override {
32205  return "BlockComment";
32206  }
32207 
32208  /**
32209  * \brief Return NMODL statement of ast node as std::string
32210  *
32211  * Every node is related to a special statement in the NMODL. This
32212  * statement can be returned as a std::string for printing to
32213  * text/json form.
32214  *
32215  * \return name of the statement as a string i.e. "COMMENT"
32216  *
32217  * \sa Ast::get_nmodl_name
32218  */
32219  std::string get_nmodl_name() const noexcept override { return "COMMENT"; }
32220 
32221  /**
32222  * \brief Get std::shared_ptr from `this` pointer of the current ast node
32223  */
32224  std::shared_ptr<Ast> get_shared_ptr() override {
32225  return std::static_pointer_cast<BlockComment>(shared_from_this());
32226  }
32227 
32228  /**
32229  * \brief Get std::shared_ptr from `this` pointer of the current ast node
32230  */
32231  std::shared_ptr<const Ast> get_shared_ptr() const override {
32232  return std::static_pointer_cast<const BlockComment>(shared_from_this());
32233  }
32234 
32235  /**
32236  * \brief Return associated token for the current ast node
32237  *
32238  * Not all ast nodes have token information. For example,
32239  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
32240  * solution of ODEs. In this case, we return nullptr to store in the
32241  * nmodl::symtab::SymbolTable.
32242  *
32243  * \return pointer to token if exist otherwise nullptr
32244  */
32245  const ModToken *get_token() const noexcept override { return token.get(); }
32246 
32247  /**
32248  * \brief Getter for member variable \ref BlockComment.statement
32249  */
32250  const std::shared_ptr<String> &get_statement() const noexcept {
32251  return statement;
32252  }
32253 
32254  /// \}
32255 
32256  /// \name Setters
32257  /// \{
32258 
32259  /**
32260  * \brief Set token for the current ast node
32261  */
32262  void set_token(const ModToken &tok) {
32263  token = std::make_shared<ModToken>(tok);
32264  }
32265 
32266  /**
32267  * \brief Setter for member variable \ref BlockComment.statement (rvalue
32268  * reference)
32269  */
32270  void set_statement(std::shared_ptr<String> &&statement);
32271 
32272  /**
32273  * \brief Setter for member variable \ref BlockComment.statement
32274  */
32275  void set_statement(const std::shared_ptr<String> &statement);
32276 
32277  /// \}
32278 
32279  /// \name Visitor
32280  /// \{
32281 
32282  /**
32283  * \brief visit children i.e. member variables of current node using provided
32284  * visitor
32285  *
32286  * Different nodes in the AST have different members (i.e. children). This
32287  * method recursively visits children using provided visitor.
32288  *
32289  * \param v Concrete visitor that will be used to recursively visit children
32290  *
32291  * \sa Ast::visit_children for example.
32292  */
32293  void visit_children(visitor::Visitor &v) override;
32294 
32295  /**
32296  * \brief visit children i.e. member variables of current node using provided
32297  * visitor
32298  *
32299  * Different nodes in the AST have different members (i.e. children). This
32300  * method recursively visits children using provided visitor.
32301  *
32302  * \param v Concrete constant visitor that will be used to recursively visit
32303  * children
32304  *
32305  * \sa Ast::visit_children for example.
32306  */
32307  void visit_children(visitor::ConstVisitor &v) const override;
32308 
32309  /**
32310  * \brief accept (or visit) the current AST node using provided visitor
32311  *
32312  * Instead of visiting children of AST node, like Ast::visit_children,
32313  * accept allows to visit the current node itself using provided concrete
32314  * visitor.
32315  *
32316  * \param v Concrete visitor that will be used to recursively visit node
32317  *
32318  * \sa Ast::accept for example.
32319  */
32320  void accept(visitor::Visitor &v) override;
32321 
32322  /**
32323  * \copydoc accept(visitor::Visitor&)
32324  */
32325  void accept(visitor::ConstVisitor &v) const override;
32326 
32327  /// \}
32328 
32329 private:
32330  /**
32331  * \brief Set this object as parent for all the children
32332  *
32333  * This should be called in every object (with children) constructor
32334  * to set parents. Since it is called only in the constructors it
32335  * should not be virtual to avoid ambiguities (issue #295).
32336  */
32337  void set_parent_in_children();
32338 };
32339 
32340 /** @} */ // end of ast_class
32341 
32342 } // namespace ast
32343 } // namespace nmodl
32344 #endif // !NMODL_AST_BLOCK_COMMENT_HPP
32345 #ifndef NMODL_AST_ONTOLOGY_STATEMENT_HPP
32346 #define NMODL_AST_ONTOLOGY_STATEMENT_HPP
32347 
32348 namespace nmodl {
32349 namespace ast {
32350 
32351 /**
32352  * @addtogroup ast_class
32353  * @ingroup ast
32354  * @{
32355  */
32356 
32357 /**
32358  * \brief Represents CURIE information in NMODL
32359  *
32360  *
32361  */
32363 private:
32364  /// Ontology name
32365  std::shared_ptr<String> ontology_id;
32366  /// token with location information
32367  std::shared_ptr<ModToken> token;
32368 
32369 public:
32370  /// \name Ctor & dtor
32371  /// \{
32372 
32373  explicit OntologyStatement(String *ontology_id);
32374  explicit OntologyStatement(const std::shared_ptr<String> &ontology_id);
32376 
32377  virtual ~OntologyStatement() = default;
32378 
32379  /// \}
32380 
32381  /**
32382  * \brief Check if the ast node is an instance of ast::OntologyStatement
32383  * \return true as object is of type ast::OntologyStatement
32384  */
32385  bool is_ontology_statement() const noexcept override { return true; }
32386 
32387  /**
32388  * \brief Return a copy of the current node
32389  *
32390  * Recursively make a new copy/clone of the current node including
32391  * all members and return a pointer to the node. This is used for
32392  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
32393  * ast.
32394  *
32395  * @return pointer to the clone/copy of the current node
32396  */
32397  OntologyStatement *clone() const override {
32398  return new OntologyStatement(*this);
32399  }
32400 
32401  /// \name Getters
32402  /// \{
32403 
32404  /**
32405  * \brief Return type (ast::AstNodeType) of ast node
32406  *
32407  * Every node in the ast has a type defined in ast::AstNodeType and this
32408  * function is used to retrieve the same.
32409  *
32410  * \return ast node type i.e. ast::AstNodeType::ONTOLOGY_STATEMENT
32411  *
32412  * \sa Ast::get_node_type_name
32413  */
32414  AstNodeType get_node_type() const noexcept override {
32416  }
32417 
32418  /**
32419  * \brief Return type (ast::AstNodeType) of ast node as std::string
32420  *
32421  * Every node in the ast has a type defined in ast::AstNodeType.
32422  * This type name can be returned as a std::string for printing
32423  * node to text/json form.
32424  *
32425  * \return name of the node type as a string i.e. "OntologyStatement"
32426  *
32427  * \sa Ast::get_node_name
32428  */
32429  std::string get_node_type_name() const noexcept override {
32430  return "OntologyStatement";
32431  }
32432 
32433  /**
32434  * \brief Return NMODL statement of ast node as std::string
32435  *
32436  * Every node is related to a special statement in the NMODL. This
32437  * statement can be returned as a std::string for printing to
32438  * text/json form.
32439  *
32440  * \return name of the statement as a string i.e. "REPRESENTS "
32441  *
32442  * \sa Ast::get_nmodl_name
32443  */
32444  std::string get_nmodl_name() const noexcept override { return "REPRESENTS "; }
32445 
32446  /**
32447  * \brief Get std::shared_ptr from `this` pointer of the current ast node
32448  */
32449  std::shared_ptr<Ast> get_shared_ptr() override {
32450  return std::static_pointer_cast<OntologyStatement>(shared_from_this());
32451  }
32452 
32453  /**
32454  * \brief Get std::shared_ptr from `this` pointer of the current ast node
32455  */
32456  std::shared_ptr<const Ast> get_shared_ptr() const override {
32457  return std::static_pointer_cast<const OntologyStatement>(
32458  shared_from_this());
32459  }
32460 
32461  /**
32462  * \brief Return associated token for the current ast node
32463  *
32464  * Not all ast nodes have token information. For example,
32465  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
32466  * solution of ODEs. In this case, we return nullptr to store in the
32467  * nmodl::symtab::SymbolTable.
32468  *
32469  * \return pointer to token if exist otherwise nullptr
32470  */
32471  const ModToken *get_token() const noexcept override { return token.get(); }
32472 
32473  /**
32474  * \brief Getter for member variable \ref OntologyStatement.ontology_id
32475  */
32476  const std::shared_ptr<String> &get_ontology_id() const noexcept {
32477  return ontology_id;
32478  }
32479 
32480  /// \}
32481 
32482  /// \name Setters
32483  /// \{
32484 
32485  /**
32486  * \brief Set token for the current ast node
32487  */
32488  void set_token(const ModToken &tok) {
32489  token = std::make_shared<ModToken>(tok);
32490  }
32491 
32492  /**
32493  * \brief Setter for member variable \ref OntologyStatement.ontology_id
32494  * (rvalue reference)
32495  */
32496  void set_ontology_id(std::shared_ptr<String> &&ontology_id);
32497 
32498  /**
32499  * \brief Setter for member variable \ref OntologyStatement.ontology_id
32500  */
32501  void set_ontology_id(const std::shared_ptr<String> &ontology_id);
32502 
32503  /// \}
32504 
32505  /// \name Visitor
32506  /// \{
32507 
32508  /**
32509  * \brief visit children i.e. member variables of current node using provided
32510  * visitor
32511  *
32512  * Different nodes in the AST have different members (i.e. children). This
32513  * method recursively visits children using provided visitor.
32514  *
32515  * \param v Concrete visitor that will be used to recursively visit children
32516  *
32517  * \sa Ast::visit_children for example.
32518  */
32519  void visit_children(visitor::Visitor &v) override;
32520 
32521  /**
32522  * \brief visit children i.e. member variables of current node using provided
32523  * visitor
32524  *
32525  * Different nodes in the AST have different members (i.e. children). This
32526  * method recursively visits children using provided visitor.
32527  *
32528  * \param v Concrete constant visitor that will be used to recursively visit
32529  * children
32530  *
32531  * \sa Ast::visit_children for example.
32532  */
32533  void visit_children(visitor::ConstVisitor &v) const override;
32534 
32535  /**
32536  * \brief accept (or visit) the current AST node using provided visitor
32537  *
32538  * Instead of visiting children of AST node, like Ast::visit_children,
32539  * accept allows to visit the current node itself using provided concrete
32540  * visitor.
32541  *
32542  * \param v Concrete visitor that will be used to recursively visit node
32543  *
32544  * \sa Ast::accept for example.
32545  */
32546  void accept(visitor::Visitor &v) override;
32547 
32548  /**
32549  * \copydoc accept(visitor::Visitor&)
32550  */
32551  void accept(visitor::ConstVisitor &v) const override;
32552 
32553  /// \}
32554 
32555 private:
32556  /**
32557  * \brief Set this object as parent for all the children
32558  *
32559  * This should be called in every object (with children) constructor
32560  * to set parents. Since it is called only in the constructors it
32561  * should not be virtual to avoid ambiguities (issue #295).
32562  */
32563  void set_parent_in_children();
32564 };
32565 
32566 /** @} */ // end of ast_class
32567 
32568 } // namespace ast
32569 } // namespace nmodl
32570 #endif // !NMODL_AST_ONTOLOGY_STATEMENT_HPP
32571 #ifndef NMODL_AST_PROGRAM_HPP
32572 #define NMODL_AST_PROGRAM_HPP
32573 #define NMODL_AST_PROGRAM_HPP_INLINE_DEFINITION_REQUIRED
32574 
32575 namespace nmodl {
32576 namespace ast {
32577 
32578 /**
32579  * @addtogroup ast_class
32580  * @ingroup ast
32581  * @{
32582  */
32583 
32584 /**
32585  * \brief Represents top level AST node for whole NMODL input
32586  *
32587  *
32588  */
32589 class Program : public Ast {
32590 private:
32591  /// Vector of top level blocks in the mod file
32593  /// token with location information
32594  std::shared_ptr<ModToken> token;
32595  /// symbol table for a block
32596  symtab::SymbolTable *symtab = nullptr;
32597  /// global symbol table for model
32599 
32600 public:
32601  /// \name Ctor & dtor
32602  /// \{
32603 
32604  explicit Program(NodeVector blocks);
32605  Program(const Program &obj);
32606 
32607  Program() = default;
32608 
32609  virtual ~Program() = default;
32610 
32611  /// \}
32612 
32613  /**
32614  * \brief Check if the ast node is an instance of ast::Program
32615  * \return true as object is of type ast::Program
32616  */
32617  bool is_program() const noexcept override { return true; }
32618 
32619  /**
32620  * \brief Return a copy of the current node
32621  *
32622  * Recursively make a new copy/clone of the current node including
32623  * all members and return a pointer to the node. This is used for
32624  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
32625  * ast.
32626  *
32627  * @return pointer to the clone/copy of the current node
32628  */
32629  Program *clone() const override { return new Program(*this); }
32630 
32631  /// \name Getters
32632  /// \{
32633 
32634  /**
32635  * \brief Return type (ast::AstNodeType) of ast node
32636  *
32637  * Every node in the ast has a type defined in ast::AstNodeType and this
32638  * function is used to retrieve the same.
32639  *
32640  * \return ast node type i.e. ast::AstNodeType::PROGRAM
32641  *
32642  * \sa Ast::get_node_type_name
32643  */
32644  AstNodeType get_node_type() const noexcept override {
32645  return AstNodeType::PROGRAM;
32646  }
32647 
32648  /**
32649  * \brief Return type (ast::AstNodeType) of ast node as std::string
32650  *
32651  * Every node in the ast has a type defined in ast::AstNodeType.
32652  * This type name can be returned as a std::string for printing
32653  * node to text/json form.
32654  *
32655  * \return name of the node type as a string i.e. "Program"
32656  *
32657  * \sa Ast::get_node_name
32658  */
32659  std::string get_node_type_name() const noexcept override { return "Program"; }
32660 
32661  /**
32662  * \brief Get std::shared_ptr from `this` pointer of the current ast node
32663  */
32664  std::shared_ptr<Ast> get_shared_ptr() override {
32665  return std::static_pointer_cast<Program>(shared_from_this());
32666  }
32667 
32668  /**
32669  * \brief Get std::shared_ptr from `this` pointer of the current ast node
32670  */
32671  std::shared_ptr<const Ast> get_shared_ptr() const override {
32672  return std::static_pointer_cast<const Program>(shared_from_this());
32673  }
32674 
32675  /**
32676  * \brief Return associated token for the current ast node
32677  *
32678  * Not all ast nodes have token information. For example,
32679  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
32680  * solution of ODEs. In this case, we return nullptr to store in the
32681  * nmodl::symtab::SymbolTable.
32682  *
32683  * \return pointer to token if exist otherwise nullptr
32684  */
32685  const ModToken *get_token() const noexcept override { return token.get(); }
32686 
32687  /**
32688  * \brief Return associated symbol table for the current ast node
32689  *
32690  * Only certain ast nodes (e.g. inherited from ast::Block) have associated
32691  * symbol table. These nodes have nmodl::symtab::SymbolTable as member
32692  * and it can be accessed using this method.
32693  *
32694  * \return pointer to the symbol table
32695  *
32696  * \sa nmodl::symtab::SymbolTable nmodl::visitor::SymtabVisitor
32697  */
32698  symtab::SymbolTable *get_symbol_table() const override { return symtab; }
32699 
32700  /**
32701  * \brief Return global symbol table for the mod file
32702  */
32704 
32705  /**
32706  * \brief Add member to blocks by raw pointer
32707  */
32708  void emplace_back_node(Node *n);
32709 
32710  /**
32711  * \brief Add member to blocks by shared_ptr
32712  */
32713  void emplace_back_node(std::shared_ptr<Node> n);
32714 
32715  /**
32716  * \brief Erase member to blocks
32717  */
32718  NodeVector::const_iterator erase_node(NodeVector::const_iterator first);
32719 
32720  /**
32721  * \brief Erase members to blocks
32722  */
32723  NodeVector::const_iterator erase_node(NodeVector::const_iterator first,
32724  NodeVector::const_iterator last);
32725 
32726  /**
32727  * \brief Erase non-consecutive members to blocks
32728  *
32729  * loosely following the cpp reference of remove_if
32730  */
32731  size_t erase_node(std::unordered_set<Node *> &to_be_erased);
32732 
32733  /**
32734  * \brief Insert member to blocks
32735  */
32736  NodeVector::const_iterator insert_node(NodeVector::const_iterator position,
32737  const std::shared_ptr<Node> &n);
32738 
32739  /**
32740  * \brief Insert members to blocks
32741  */
32742  template <class NodeType, class InputIterator>
32743  void insert_node(NodeVector::const_iterator position, NodeType &to,
32744  InputIterator first, InputIterator last);
32745 
32746  /**
32747  * \brief Reset member to blocks
32748  */
32749  void reset_node(NodeVector::const_iterator position, Node *n);
32750 
32751  /**
32752  * \brief Reset member to blocks
32753  */
32754  void reset_node(NodeVector::const_iterator position, std::shared_ptr<Node> n);
32755 
32756  /**
32757  * \brief Getter for member variable \ref Program.blocks
32758  */
32759  const NodeVector &get_blocks() const noexcept { return blocks; }
32760 
32761  /// \}
32762 
32763  /// \name Setters
32764  /// \{
32765 
32766  /**
32767  * \brief Set token for the current ast node
32768  */
32769  void set_token(const ModToken &tok) {
32770  token = std::make_shared<ModToken>(tok);
32771  }
32772 
32773  /**
32774  * \brief Set symbol table for the current ast node
32775  *
32776  * Top level, block scoped nodes store symbol table in the ast node.
32777  * nmodl::visitor::SymtabVisitor then used this method to setup symbol table
32778  * for every node in the ast.
32779  *
32780  * \sa nmodl::visitor::SymtabVisitor
32781  */
32782  void set_symbol_table(symtab::SymbolTable *newsymtab) override {
32783  symtab = newsymtab;
32784  }
32785 
32786  /**
32787  * \brief Setter for member variable \ref Program.blocks (rvalue reference)
32788  */
32789  void set_blocks(NodeVector &&blocks);
32790 
32791  /**
32792  * \brief Setter for member variable \ref Program.blocks
32793  */
32794  void set_blocks(const NodeVector &blocks);
32795 
32796  /// \}
32797 
32798  /// \name Visitor
32799  /// \{
32800 
32801  /**
32802  * \brief visit children i.e. member variables of current node using provided
32803  * visitor
32804  *
32805  * Different nodes in the AST have different members (i.e. children). This
32806  * method recursively visits children using provided visitor.
32807  *
32808  * \param v Concrete visitor that will be used to recursively visit children
32809  *
32810  * \sa Ast::visit_children for example.
32811  */
32812  void visit_children(visitor::Visitor &v) override;
32813 
32814  /**
32815  * \brief visit children i.e. member variables of current node using provided
32816  * visitor
32817  *
32818  * Different nodes in the AST have different members (i.e. children). This
32819  * method recursively visits children using provided visitor.
32820  *
32821  * \param v Concrete constant visitor that will be used to recursively visit
32822  * children
32823  *
32824  * \sa Ast::visit_children for example.
32825  */
32826  void visit_children(visitor::ConstVisitor &v) const override;
32827 
32828  /**
32829  * \brief accept (or visit) the current AST node using provided visitor
32830  *
32831  * Instead of visiting children of AST node, like Ast::visit_children,
32832  * accept allows to visit the current node itself using provided concrete
32833  * visitor.
32834  *
32835  * \param v Concrete visitor that will be used to recursively visit node
32836  *
32837  * \sa Ast::accept for example.
32838  */
32839  void accept(visitor::Visitor &v) override;
32840 
32841  /**
32842  * \copydoc accept(visitor::Visitor&)
32843  */
32844  void accept(visitor::ConstVisitor &v) const override;
32845 
32846  /// \}
32847 
32848 private:
32849  /**
32850  * \brief Set this object as parent for all the children
32851  *
32852  * This should be called in every object (with children) constructor
32853  * to set parents. Since it is called only in the constructors it
32854  * should not be virtual to avoid ambiguities (issue #295).
32855  */
32856  void set_parent_in_children();
32857 };
32858 
32859 /** @} */ // end of ast_class
32860 
32861 } // namespace ast
32862 } // namespace nmodl
32863 #endif // !NMODL_AST_PROGRAM_HPP
32864 #ifndef NMODL_AST_NRN_STATE_BLOCK_HPP
32865 #define NMODL_AST_NRN_STATE_BLOCK_HPP
32866 
32867 namespace nmodl {
32868 namespace ast {
32869 
32870 /**
32871  * @addtogroup ast_class
32872  * @ingroup ast
32873  * @{
32874  */
32875 
32876 /**
32877  * \brief Represents the coreneuron nrn_state callback function
32878  *
32879  *
32880  */
32881 class NrnStateBlock : public Block {
32882 private:
32883  /// solve blocks to be called or generated
32885  /// token with location information
32886  std::shared_ptr<ModToken> token;
32887  /// symbol table for a block
32888  symtab::SymbolTable *symtab = nullptr;
32889 
32890 public:
32891  /// \name Ctor & dtor
32892  /// \{
32893 
32894  explicit NrnStateBlock(StatementVector solve_statements);
32895  NrnStateBlock(const NrnStateBlock &obj);
32896 
32897  virtual ~NrnStateBlock() = default;
32898 
32899  /// \}
32900 
32901  /**
32902  * \brief Check if the ast node is an instance of ast::NrnStateBlock
32903  * \return true as object is of type ast::NrnStateBlock
32904  */
32905  bool is_nrn_state_block() const noexcept override { return true; }
32906 
32907  /**
32908  * \brief Return a copy of the current node
32909  *
32910  * Recursively make a new copy/clone of the current node including
32911  * all members and return a pointer to the node. This is used for
32912  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
32913  * ast.
32914  *
32915  * @return pointer to the clone/copy of the current node
32916  */
32917  NrnStateBlock *clone() const override { return new NrnStateBlock(*this); }
32918 
32919  /// \name Getters
32920  /// \{
32921 
32922  /**
32923  * \brief Return type (ast::AstNodeType) of ast node
32924  *
32925  * Every node in the ast has a type defined in ast::AstNodeType and this
32926  * function is used to retrieve the same.
32927  *
32928  * \return ast node type i.e. ast::AstNodeType::NRN_STATE_BLOCK
32929  *
32930  * \sa Ast::get_node_type_name
32931  */
32932  AstNodeType get_node_type() const noexcept override {
32934  }
32935 
32936  /**
32937  * \brief Return type (ast::AstNodeType) of ast node as std::string
32938  *
32939  * Every node in the ast has a type defined in ast::AstNodeType.
32940  * This type name can be returned as a std::string for printing
32941  * node to text/json form.
32942  *
32943  * \return name of the node type as a string i.e. "NrnStateBlock"
32944  *
32945  * \sa Ast::get_node_name
32946  */
32947  std::string get_node_type_name() const noexcept override {
32948  return "NrnStateBlock";
32949  }
32950 
32951  /**
32952  * \brief Return NMODL statement of ast node as std::string
32953  *
32954  * Every node is related to a special statement in the NMODL. This
32955  * statement can be returned as a std::string for printing to
32956  * text/json form.
32957  *
32958  * \return name of the statement as a string i.e. "NRN_STATE "
32959  *
32960  * \sa Ast::get_nmodl_name
32961  */
32962  std::string get_nmodl_name() const noexcept override { return "NRN_STATE "; }
32963 
32964  /**
32965  * \brief Get std::shared_ptr from `this` pointer of the current ast node
32966  */
32967  std::shared_ptr<Ast> get_shared_ptr() override {
32968  return std::static_pointer_cast<NrnStateBlock>(shared_from_this());
32969  }
32970 
32971  /**
32972  * \brief Get std::shared_ptr from `this` pointer of the current ast node
32973  */
32974  std::shared_ptr<const Ast> get_shared_ptr() const override {
32975  return std::static_pointer_cast<const NrnStateBlock>(shared_from_this());
32976  }
32977 
32978  /**
32979  * \brief Return associated token for the current ast node
32980  *
32981  * Not all ast nodes have token information. For example,
32982  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
32983  * solution of ODEs. In this case, we return nullptr to store in the
32984  * nmodl::symtab::SymbolTable.
32985  *
32986  * \return pointer to token if exist otherwise nullptr
32987  */
32988  const ModToken *get_token() const noexcept override { return token.get(); }
32989 
32990  /**
32991  * \brief Return associated symbol table for the current ast node
32992  *
32993  * Only certain ast nodes (e.g. inherited from ast::Block) have associated
32994  * symbol table. These nodes have nmodl::symtab::SymbolTable as member
32995  * and it can be accessed using this method.
32996  *
32997  * \return pointer to the symbol table
32998  *
32999  * \sa nmodl::symtab::SymbolTable nmodl::visitor::SymtabVisitor
33000  */
33001  symtab::SymbolTable *get_symbol_table() const override { return symtab; }
33002 
33003  /**
33004  * \brief Getter for member variable \ref NrnStateBlock.solve_statements
33005  */
33006  const StatementVector &get_solve_statements() const noexcept {
33007  return solve_statements;
33008  }
33009 
33010  /// \}
33011 
33012  /// \name Setters
33013  /// \{
33014 
33015  /**
33016  * \brief Set token for the current ast node
33017  */
33018  void set_token(const ModToken &tok) {
33019  token = std::make_shared<ModToken>(tok);
33020  }
33021 
33022  /**
33023  * \brief Set symbol table for the current ast node
33024  *
33025  * Top level, block scoped nodes store symbol table in the ast node.
33026  * nmodl::visitor::SymtabVisitor then used this method to setup symbol table
33027  * for every node in the ast.
33028  *
33029  * \sa nmodl::visitor::SymtabVisitor
33030  */
33031  void set_symbol_table(symtab::SymbolTable *newsymtab) override {
33032  symtab = newsymtab;
33033  }
33034 
33035  /**
33036  * \brief Setter for member variable \ref NrnStateBlock.solve_statements
33037  * (rvalue reference)
33038  */
33039  void set_solve_statements(StatementVector &&solve_statements);
33040 
33041  /**
33042  * \brief Setter for member variable \ref NrnStateBlock.solve_statements
33043  */
33044  void set_solve_statements(const StatementVector &solve_statements);
33045 
33046  /// \}
33047 
33048  /// \name Visitor
33049  /// \{
33050 
33051  /**
33052  * \brief visit children i.e. member variables of current node using provided
33053  * visitor
33054  *
33055  * Different nodes in the AST have different members (i.e. children). This
33056  * method recursively visits children using provided visitor.
33057  *
33058  * \param v Concrete visitor that will be used to recursively visit children
33059  *
33060  * \sa Ast::visit_children for example.
33061  */
33062  void visit_children(visitor::Visitor &v) override;
33063 
33064  /**
33065  * \brief visit children i.e. member variables of current node using provided
33066  * visitor
33067  *
33068  * Different nodes in the AST have different members (i.e. children). This
33069  * method recursively visits children using provided visitor.
33070  *
33071  * \param v Concrete constant visitor that will be used to recursively visit
33072  * children
33073  *
33074  * \sa Ast::visit_children for example.
33075  */
33076  void visit_children(visitor::ConstVisitor &v) const override;
33077 
33078  /**
33079  * \brief accept (or visit) the current AST node using provided visitor
33080  *
33081  * Instead of visiting children of AST node, like Ast::visit_children,
33082  * accept allows to visit the current node itself using provided concrete
33083  * visitor.
33084  *
33085  * \param v Concrete visitor that will be used to recursively visit node
33086  *
33087  * \sa Ast::accept for example.
33088  */
33089  void accept(visitor::Visitor &v) override;
33090 
33091  /**
33092  * \copydoc accept(visitor::Visitor&)
33093  */
33094  void accept(visitor::ConstVisitor &v) const override;
33095 
33096  /// \}
33097 
33098 private:
33099  /**
33100  * \brief Set this object as parent for all the children
33101  *
33102  * This should be called in every object (with children) constructor
33103  * to set parents. Since it is called only in the constructors it
33104  * should not be virtual to avoid ambiguities (issue #295).
33105  */
33106  void set_parent_in_children();
33107 };
33108 
33109 /** @} */ // end of ast_class
33110 
33111 } // namespace ast
33112 } // namespace nmodl
33113 #endif // !NMODL_AST_NRN_STATE_BLOCK_HPP
33114 #ifndef NMODL_AST_EIGEN_NEWTON_SOLVER_BLOCK_HPP
33115 #define NMODL_AST_EIGEN_NEWTON_SOLVER_BLOCK_HPP
33116 
33117 namespace nmodl {
33118 namespace ast {
33119 
33120 /**
33121  * @addtogroup ast_class
33122  * @ingroup ast
33123  * @{
33124  */
33125 
33126 /**
33127  * \brief Represent newton solver solution block based on Eigen
33128  *
33129  *
33130  */
33132 private:
33133  /// number of state vars used in solve
33134  std::shared_ptr<Integer> n_state_vars;
33135  /// Statements to be declared in the functor
33136  std::shared_ptr<StatementBlock> variable_block;
33137  /// Statement block to be executed before calling newton solver
33138  std::shared_ptr<StatementBlock> initialize_block;
33139  /// update X from states
33140  std::shared_ptr<StatementBlock> setup_x_block;
33141  /// odes as functor for eigen
33142  std::shared_ptr<StatementBlock> functor_block;
33143  /// update back states from X
33144  std::shared_ptr<StatementBlock> update_states_block;
33145  /// Statement block to be executed after calling newton solver
33146  std::shared_ptr<StatementBlock> finalize_block;
33147  /// token with location information
33148  std::shared_ptr<ModToken> token;
33149  /// symbol table for a block
33150  symtab::SymbolTable *symtab = nullptr;
33151 
33152 public:
33153  /// \name Ctor & dtor
33154  /// \{
33155 
33156  explicit EigenNewtonSolverBlock(Integer *n_state_vars,
33157  StatementBlock *variable_block,
33158  StatementBlock *initialize_block,
33159  StatementBlock *setup_x_block,
33160  StatementBlock *functor_block,
33161  StatementBlock *update_states_block,
33162  StatementBlock *finalize_block);
33163  explicit EigenNewtonSolverBlock(
33164  const std::shared_ptr<Integer> &n_state_vars,
33165  const std::shared_ptr<StatementBlock> &variable_block,
33166  const std::shared_ptr<StatementBlock> &initialize_block,
33167  const std::shared_ptr<StatementBlock> &setup_x_block,
33168  const std::shared_ptr<StatementBlock> &functor_block,
33169  const std::shared_ptr<StatementBlock> &update_states_block,
33170  const std::shared_ptr<StatementBlock> &finalize_block);
33172 
33173  virtual ~EigenNewtonSolverBlock() = default;
33174 
33175  /// \}
33176 
33177  /**
33178  * \brief Check if the ast node is an instance of ast::EigenNewtonSolverBlock
33179  * \return true as object is of type ast::EigenNewtonSolverBlock
33180  */
33181  bool is_eigen_newton_solver_block() const noexcept override { return true; }
33182 
33183  /**
33184  * \brief Return a copy of the current node
33185  *
33186  * Recursively make a new copy/clone of the current node including
33187  * all members and return a pointer to the node. This is used for
33188  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
33189  * ast.
33190  *
33191  * @return pointer to the clone/copy of the current node
33192  */
33193  EigenNewtonSolverBlock *clone() const override {
33194  return new EigenNewtonSolverBlock(*this);
33195  }
33196 
33197  /// \name Getters
33198  /// \{
33199 
33200  /**
33201  * \brief Return type (ast::AstNodeType) of ast node
33202  *
33203  * Every node in the ast has a type defined in ast::AstNodeType and this
33204  * function is used to retrieve the same.
33205  *
33206  * \return ast node type i.e. ast::AstNodeType::EIGEN_NEWTON_SOLVER_BLOCK
33207  *
33208  * \sa Ast::get_node_type_name
33209  */
33210  AstNodeType get_node_type() const noexcept override {
33212  }
33213 
33214  /**
33215  * \brief Return type (ast::AstNodeType) of ast node as std::string
33216  *
33217  * Every node in the ast has a type defined in ast::AstNodeType.
33218  * This type name can be returned as a std::string for printing
33219  * node to text/json form.
33220  *
33221  * \return name of the node type as a string i.e. "EigenNewtonSolverBlock"
33222  *
33223  * \sa Ast::get_node_name
33224  */
33225  std::string get_node_type_name() const noexcept override {
33226  return "EigenNewtonSolverBlock";
33227  }
33228 
33229  /**
33230  * \brief Return NMODL statement of ast node as std::string
33231  *
33232  * Every node is related to a special statement in the NMODL. This
33233  * statement can be returned as a std::string for printing to
33234  * text/json form.
33235  *
33236  * \return name of the statement as a string i.e. "EIGEN_NEWTON_SOLVE"
33237  *
33238  * \sa Ast::get_nmodl_name
33239  */
33240  std::string get_nmodl_name() const noexcept override {
33241  return "EIGEN_NEWTON_SOLVE";
33242  }
33243 
33244  /**
33245  * \brief Get std::shared_ptr from `this` pointer of the current ast node
33246  */
33247  std::shared_ptr<Ast> get_shared_ptr() override {
33248  return std::static_pointer_cast<EigenNewtonSolverBlock>(shared_from_this());
33249  }
33250 
33251  /**
33252  * \brief Get std::shared_ptr from `this` pointer of the current ast node
33253  */
33254  std::shared_ptr<const Ast> get_shared_ptr() const override {
33255  return std::static_pointer_cast<const EigenNewtonSolverBlock>(
33256  shared_from_this());
33257  }
33258 
33259  /**
33260  * \brief Return associated token for the current ast node
33261  *
33262  * Not all ast nodes have token information. For example,
33263  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
33264  * solution of ODEs. In this case, we return nullptr to store in the
33265  * nmodl::symtab::SymbolTable.
33266  *
33267  * \return pointer to token if exist otherwise nullptr
33268  */
33269  const ModToken *get_token() const noexcept override { return token.get(); }
33270 
33271  /**
33272  * \brief Return associated symbol table for the current ast node
33273  *
33274  * Only certain ast nodes (e.g. inherited from ast::Block) have associated
33275  * symbol table. These nodes have nmodl::symtab::SymbolTable as member
33276  * and it can be accessed using this method.
33277  *
33278  * \return pointer to the symbol table
33279  *
33280  * \sa nmodl::symtab::SymbolTable nmodl::visitor::SymtabVisitor
33281  */
33282  symtab::SymbolTable *get_symbol_table() const override { return symtab; }
33283 
33284  /**
33285  * \brief Getter for member variable \ref EigenNewtonSolverBlock.n_state_vars
33286  */
33287  const std::shared_ptr<Integer> &get_n_state_vars() const noexcept {
33288  return n_state_vars;
33289  }
33290 
33291  /**
33292  * \brief Getter for member variable \ref
33293  * EigenNewtonSolverBlock.variable_block
33294  */
33295  const std::shared_ptr<StatementBlock> &get_variable_block() const noexcept {
33296  return variable_block;
33297  }
33298 
33299  /**
33300  * \brief Getter for member variable \ref
33301  * EigenNewtonSolverBlock.initialize_block
33302  */
33303  const std::shared_ptr<StatementBlock> &get_initialize_block() const noexcept {
33304  return initialize_block;
33305  }
33306 
33307  /**
33308  * \brief Getter for member variable \ref EigenNewtonSolverBlock.setup_x_block
33309  */
33310  const std::shared_ptr<StatementBlock> &get_setup_x_block() const noexcept {
33311  return setup_x_block;
33312  }
33313 
33314  /**
33315  * \brief Getter for member variable \ref EigenNewtonSolverBlock.functor_block
33316  */
33317  const std::shared_ptr<StatementBlock> &get_functor_block() const noexcept {
33318  return functor_block;
33319  }
33320 
33321  /**
33322  * \brief Getter for member variable \ref
33323  * EigenNewtonSolverBlock.update_states_block
33324  */
33325  const std::shared_ptr<StatementBlock> &get_update_states_block() const
33326  noexcept {
33327  return update_states_block;
33328  }
33329 
33330  /**
33331  * \brief Getter for member variable \ref
33332  * EigenNewtonSolverBlock.finalize_block
33333  */
33334  const std::shared_ptr<StatementBlock> &get_finalize_block() const noexcept {
33335  return finalize_block;
33336  }
33337 
33338  /// \}
33339 
33340  /// \name Setters
33341  /// \{
33342 
33343  /**
33344  * \brief Set token for the current ast node
33345  */
33346  void set_token(const ModToken &tok) {
33347  token = std::make_shared<ModToken>(tok);
33348  }
33349 
33350  /**
33351  * \brief Set symbol table for the current ast node
33352  *
33353  * Top level, block scoped nodes store symbol table in the ast node.
33354  * nmodl::visitor::SymtabVisitor then used this method to setup symbol table
33355  * for every node in the ast.
33356  *
33357  * \sa nmodl::visitor::SymtabVisitor
33358  */
33359  void set_symbol_table(symtab::SymbolTable *newsymtab) override {
33360  symtab = newsymtab;
33361  }
33362 
33363  /**
33364  * \brief Setter for member variable \ref EigenNewtonSolverBlock.n_state_vars
33365  * (rvalue reference)
33366  */
33367  void set_n_state_vars(std::shared_ptr<Integer> &&n_state_vars);
33368 
33369  /**
33370  * \brief Setter for member variable \ref EigenNewtonSolverBlock.n_state_vars
33371  */
33372  void set_n_state_vars(const std::shared_ptr<Integer> &n_state_vars);
33373 
33374  /**
33375  * \brief Setter for member variable \ref
33376  * EigenNewtonSolverBlock.variable_block (rvalue reference)
33377  */
33378  void set_variable_block(std::shared_ptr<StatementBlock> &&variable_block);
33379 
33380  /**
33381  * \brief Setter for member variable \ref
33382  * EigenNewtonSolverBlock.variable_block
33383  */
33384  void
33385  set_variable_block(const std::shared_ptr<StatementBlock> &variable_block);
33386 
33387  /**
33388  * \brief Setter for member variable \ref
33389  * EigenNewtonSolverBlock.initialize_block (rvalue reference)
33390  */
33391  void set_initialize_block(std::shared_ptr<StatementBlock> &&initialize_block);
33392 
33393  /**
33394  * \brief Setter for member variable \ref
33395  * EigenNewtonSolverBlock.initialize_block
33396  */
33397  void
33398  set_initialize_block(const std::shared_ptr<StatementBlock> &initialize_block);
33399 
33400  /**
33401  * \brief Setter for member variable \ref EigenNewtonSolverBlock.setup_x_block
33402  * (rvalue reference)
33403  */
33404  void set_setup_x_block(std::shared_ptr<StatementBlock> &&setup_x_block);
33405 
33406  /**
33407  * \brief Setter for member variable \ref EigenNewtonSolverBlock.setup_x_block
33408  */
33409  void set_setup_x_block(const std::shared_ptr<StatementBlock> &setup_x_block);
33410 
33411  /**
33412  * \brief Setter for member variable \ref EigenNewtonSolverBlock.functor_block
33413  * (rvalue reference)
33414  */
33415  void set_functor_block(std::shared_ptr<StatementBlock> &&functor_block);
33416 
33417  /**
33418  * \brief Setter for member variable \ref EigenNewtonSolverBlock.functor_block
33419  */
33420  void set_functor_block(const std::shared_ptr<StatementBlock> &functor_block);
33421 
33422  /**
33423  * \brief Setter for member variable \ref
33424  * EigenNewtonSolverBlock.update_states_block (rvalue reference)
33425  */
33426  void set_update_states_block(
33427  std::shared_ptr<StatementBlock> &&update_states_block);
33428 
33429  /**
33430  * \brief Setter for member variable \ref
33431  * EigenNewtonSolverBlock.update_states_block
33432  */
33433  void set_update_states_block(
33434  const std::shared_ptr<StatementBlock> &update_states_block);
33435 
33436  /**
33437  * \brief Setter for member variable \ref
33438  * EigenNewtonSolverBlock.finalize_block (rvalue reference)
33439  */
33440  void set_finalize_block(std::shared_ptr<StatementBlock> &&finalize_block);
33441 
33442  /**
33443  * \brief Setter for member variable \ref
33444  * EigenNewtonSolverBlock.finalize_block
33445  */
33446  void
33447  set_finalize_block(const std::shared_ptr<StatementBlock> &finalize_block);
33448 
33449  /// \}
33450 
33451  /// \name Visitor
33452  /// \{
33453 
33454  /**
33455  * \brief visit children i.e. member variables of current node using provided
33456  * visitor
33457  *
33458  * Different nodes in the AST have different members (i.e. children). This
33459  * method recursively visits children using provided visitor.
33460  *
33461  * \param v Concrete visitor that will be used to recursively visit children
33462  *
33463  * \sa Ast::visit_children for example.
33464  */
33465  void visit_children(visitor::Visitor &v) override;
33466 
33467  /**
33468  * \brief visit children i.e. member variables of current node using provided
33469  * visitor
33470  *
33471  * Different nodes in the AST have different members (i.e. children). This
33472  * method recursively visits children using provided visitor.
33473  *
33474  * \param v Concrete constant visitor that will be used to recursively visit
33475  * children
33476  *
33477  * \sa Ast::visit_children for example.
33478  */
33479  void visit_children(visitor::ConstVisitor &v) const override;
33480 
33481  /**
33482  * \brief accept (or visit) the current AST node using provided visitor
33483  *
33484  * Instead of visiting children of AST node, like Ast::visit_children,
33485  * accept allows to visit the current node itself using provided concrete
33486  * visitor.
33487  *
33488  * \param v Concrete visitor that will be used to recursively visit node
33489  *
33490  * \sa Ast::accept for example.
33491  */
33492  void accept(visitor::Visitor &v) override;
33493 
33494  /**
33495  * \copydoc accept(visitor::Visitor&)
33496  */
33497  void accept(visitor::ConstVisitor &v) const override;
33498 
33499  /// \}
33500 
33501 private:
33502  /**
33503  * \brief Set this object as parent for all the children
33504  *
33505  * This should be called in every object (with children) constructor
33506  * to set parents. Since it is called only in the constructors it
33507  * should not be virtual to avoid ambiguities (issue #295).
33508  */
33509  void set_parent_in_children();
33510 };
33511 
33512 /** @} */ // end of ast_class
33513 
33514 } // namespace ast
33515 } // namespace nmodl
33516 #endif // !NMODL_AST_EIGEN_NEWTON_SOLVER_BLOCK_HPP
33517 #ifndef NMODL_AST_EIGEN_LINEAR_SOLVER_BLOCK_HPP
33518 #define NMODL_AST_EIGEN_LINEAR_SOLVER_BLOCK_HPP
33519 
33520 namespace nmodl {
33521 namespace ast {
33522 
33523 /**
33524  * @addtogroup ast_class
33525  * @ingroup ast
33526  * @{
33527  */
33528 
33529 /**
33530  * \brief Represent linear solver solution block based on Eigen
33531  *
33532  *
33533  */
33535 private:
33536  /// number of state vars used in solve
33537  std::shared_ptr<Integer> n_state_vars;
33538  /// Statements to be declared in the functor
33539  std::shared_ptr<StatementBlock> variable_block;
33540  /// Statement block to be executed before calling linear solver
33541  std::shared_ptr<StatementBlock> initialize_block;
33542  /// update X from states
33543  std::shared_ptr<StatementBlock> setup_x_block;
33544  /// update back states from X
33545  std::shared_ptr<StatementBlock> update_states_block;
33546  /// Statement block to be executed after calling linear solver
33547  std::shared_ptr<StatementBlock> finalize_block;
33548  /// token with location information
33549  std::shared_ptr<ModToken> token;
33550  /// symbol table for a block
33551  symtab::SymbolTable *symtab = nullptr;
33552 
33553 public:
33554  /// \name Ctor & dtor
33555  /// \{
33556 
33557  explicit EigenLinearSolverBlock(Integer *n_state_vars,
33558  StatementBlock *variable_block,
33559  StatementBlock *initialize_block,
33560  StatementBlock *setup_x_block,
33561  StatementBlock *update_states_block,
33562  StatementBlock *finalize_block);
33563  explicit EigenLinearSolverBlock(
33564  const std::shared_ptr<Integer> &n_state_vars,
33565  const std::shared_ptr<StatementBlock> &variable_block,
33566  const std::shared_ptr<StatementBlock> &initialize_block,
33567  const std::shared_ptr<StatementBlock> &setup_x_block,
33568  const std::shared_ptr<StatementBlock> &update_states_block,
33569  const std::shared_ptr<StatementBlock> &finalize_block);
33571 
33572  virtual ~EigenLinearSolverBlock() = default;
33573 
33574  /// \}
33575 
33576  /**
33577  * \brief Check if the ast node is an instance of ast::EigenLinearSolverBlock
33578  * \return true as object is of type ast::EigenLinearSolverBlock
33579  */
33580  bool is_eigen_linear_solver_block() const noexcept override { return true; }
33581 
33582  /**
33583  * \brief Return a copy of the current node
33584  *
33585  * Recursively make a new copy/clone of the current node including
33586  * all members and return a pointer to the node. This is used for
33587  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
33588  * ast.
33589  *
33590  * @return pointer to the clone/copy of the current node
33591  */
33592  EigenLinearSolverBlock *clone() const override {
33593  return new EigenLinearSolverBlock(*this);
33594  }
33595 
33596  /// \name Getters
33597  /// \{
33598 
33599  /**
33600  * \brief Return type (ast::AstNodeType) of ast node
33601  *
33602  * Every node in the ast has a type defined in ast::AstNodeType and this
33603  * function is used to retrieve the same.
33604  *
33605  * \return ast node type i.e. ast::AstNodeType::EIGEN_LINEAR_SOLVER_BLOCK
33606  *
33607  * \sa Ast::get_node_type_name
33608  */
33609  AstNodeType get_node_type() const noexcept override {
33611  }
33612 
33613  /**
33614  * \brief Return type (ast::AstNodeType) of ast node as std::string
33615  *
33616  * Every node in the ast has a type defined in ast::AstNodeType.
33617  * This type name can be returned as a std::string for printing
33618  * node to text/json form.
33619  *
33620  * \return name of the node type as a string i.e. "EigenLinearSolverBlock"
33621  *
33622  * \sa Ast::get_node_name
33623  */
33624  std::string get_node_type_name() const noexcept override {
33625  return "EigenLinearSolverBlock";
33626  }
33627 
33628  /**
33629  * \brief Return NMODL statement of ast node as std::string
33630  *
33631  * Every node is related to a special statement in the NMODL. This
33632  * statement can be returned as a std::string for printing to
33633  * text/json form.
33634  *
33635  * \return name of the statement as a string i.e. "EIGEN_LINEAR_SOLVE"
33636  *
33637  * \sa Ast::get_nmodl_name
33638  */
33639  std::string get_nmodl_name() const noexcept override {
33640  return "EIGEN_LINEAR_SOLVE";
33641  }
33642 
33643  /**
33644  * \brief Get std::shared_ptr from `this` pointer of the current ast node
33645  */
33646  std::shared_ptr<Ast> get_shared_ptr() override {
33647  return std::static_pointer_cast<EigenLinearSolverBlock>(shared_from_this());
33648  }
33649 
33650  /**
33651  * \brief Get std::shared_ptr from `this` pointer of the current ast node
33652  */
33653  std::shared_ptr<const Ast> get_shared_ptr() const override {
33654  return std::static_pointer_cast<const EigenLinearSolverBlock>(
33655  shared_from_this());
33656  }
33657 
33658  /**
33659  * \brief Return associated token for the current ast node
33660  *
33661  * Not all ast nodes have token information. For example,
33662  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
33663  * solution of ODEs. In this case, we return nullptr to store in the
33664  * nmodl::symtab::SymbolTable.
33665  *
33666  * \return pointer to token if exist otherwise nullptr
33667  */
33668  const ModToken *get_token() const noexcept override { return token.get(); }
33669 
33670  /**
33671  * \brief Return associated symbol table for the current ast node
33672  *
33673  * Only certain ast nodes (e.g. inherited from ast::Block) have associated
33674  * symbol table. These nodes have nmodl::symtab::SymbolTable as member
33675  * and it can be accessed using this method.
33676  *
33677  * \return pointer to the symbol table
33678  *
33679  * \sa nmodl::symtab::SymbolTable nmodl::visitor::SymtabVisitor
33680  */
33681  symtab::SymbolTable *get_symbol_table() const override { return symtab; }
33682 
33683  /**
33684  * \brief Getter for member variable \ref EigenLinearSolverBlock.n_state_vars
33685  */
33686  const std::shared_ptr<Integer> &get_n_state_vars() const noexcept {
33687  return n_state_vars;
33688  }
33689 
33690  /**
33691  * \brief Getter for member variable \ref
33692  * EigenLinearSolverBlock.variable_block
33693  */
33694  const std::shared_ptr<StatementBlock> &get_variable_block() const noexcept {
33695  return variable_block;
33696  }
33697 
33698  /**
33699  * \brief Getter for member variable \ref
33700  * EigenLinearSolverBlock.initialize_block
33701  */
33702  const std::shared_ptr<StatementBlock> &get_initialize_block() const noexcept {
33703  return initialize_block;
33704  }
33705 
33706  /**
33707  * \brief Getter for member variable \ref EigenLinearSolverBlock.setup_x_block
33708  */
33709  const std::shared_ptr<StatementBlock> &get_setup_x_block() const noexcept {
33710  return setup_x_block;
33711  }
33712 
33713  /**
33714  * \brief Getter for member variable \ref
33715  * EigenLinearSolverBlock.update_states_block
33716  */
33717  const std::shared_ptr<StatementBlock> &get_update_states_block() const
33718  noexcept {
33719  return update_states_block;
33720  }
33721 
33722  /**
33723  * \brief Getter for member variable \ref
33724  * EigenLinearSolverBlock.finalize_block
33725  */
33726  const std::shared_ptr<StatementBlock> &get_finalize_block() const noexcept {
33727  return finalize_block;
33728  }
33729 
33730  /// \}
33731 
33732  /// \name Setters
33733  /// \{
33734 
33735  /**
33736  * \brief Set token for the current ast node
33737  */
33738  void set_token(const ModToken &tok) {
33739  token = std::make_shared<ModToken>(tok);
33740  }
33741 
33742  /**
33743  * \brief Set symbol table for the current ast node
33744  *
33745  * Top level, block scoped nodes store symbol table in the ast node.
33746  * nmodl::visitor::SymtabVisitor then used this method to setup symbol table
33747  * for every node in the ast.
33748  *
33749  * \sa nmodl::visitor::SymtabVisitor
33750  */
33751  void set_symbol_table(symtab::SymbolTable *newsymtab) override {
33752  symtab = newsymtab;
33753  }
33754 
33755  /**
33756  * \brief Setter for member variable \ref EigenLinearSolverBlock.n_state_vars
33757  * (rvalue reference)
33758  */
33759  void set_n_state_vars(std::shared_ptr<Integer> &&n_state_vars);
33760 
33761  /**
33762  * \brief Setter for member variable \ref EigenLinearSolverBlock.n_state_vars
33763  */
33764  void set_n_state_vars(const std::shared_ptr<Integer> &n_state_vars);
33765 
33766  /**
33767  * \brief Setter for member variable \ref
33768  * EigenLinearSolverBlock.variable_block (rvalue reference)
33769  */
33770  void set_variable_block(std::shared_ptr<StatementBlock> &&variable_block);
33771 
33772  /**
33773  * \brief Setter for member variable \ref
33774  * EigenLinearSolverBlock.variable_block
33775  */
33776  void
33777  set_variable_block(const std::shared_ptr<StatementBlock> &variable_block);
33778 
33779  /**
33780  * \brief Setter for member variable \ref
33781  * EigenLinearSolverBlock.initialize_block (rvalue reference)
33782  */
33783  void set_initialize_block(std::shared_ptr<StatementBlock> &&initialize_block);
33784 
33785  /**
33786  * \brief Setter for member variable \ref
33787  * EigenLinearSolverBlock.initialize_block
33788  */
33789  void
33790  set_initialize_block(const std::shared_ptr<StatementBlock> &initialize_block);
33791 
33792  /**
33793  * \brief Setter for member variable \ref EigenLinearSolverBlock.setup_x_block
33794  * (rvalue reference)
33795  */
33796  void set_setup_x_block(std::shared_ptr<StatementBlock> &&setup_x_block);
33797 
33798  /**
33799  * \brief Setter for member variable \ref EigenLinearSolverBlock.setup_x_block
33800  */
33801  void set_setup_x_block(const std::shared_ptr<StatementBlock> &setup_x_block);
33802 
33803  /**
33804  * \brief Setter for member variable \ref
33805  * EigenLinearSolverBlock.update_states_block (rvalue reference)
33806  */
33807  void set_update_states_block(
33808  std::shared_ptr<StatementBlock> &&update_states_block);
33809 
33810  /**
33811  * \brief Setter for member variable \ref
33812  * EigenLinearSolverBlock.update_states_block
33813  */
33814  void set_update_states_block(
33815  const std::shared_ptr<StatementBlock> &update_states_block);
33816 
33817  /**
33818  * \brief Setter for member variable \ref
33819  * EigenLinearSolverBlock.finalize_block (rvalue reference)
33820  */
33821  void set_finalize_block(std::shared_ptr<StatementBlock> &&finalize_block);
33822 
33823  /**
33824  * \brief Setter for member variable \ref
33825  * EigenLinearSolverBlock.finalize_block
33826  */
33827  void
33828  set_finalize_block(const std::shared_ptr<StatementBlock> &finalize_block);
33829 
33830  /// \}
33831 
33832  /// \name Visitor
33833  /// \{
33834 
33835  /**
33836  * \brief visit children i.e. member variables of current node using provided
33837  * visitor
33838  *
33839  * Different nodes in the AST have different members (i.e. children). This
33840  * method recursively visits children using provided visitor.
33841  *
33842  * \param v Concrete visitor that will be used to recursively visit children
33843  *
33844  * \sa Ast::visit_children for example.
33845  */
33846  void visit_children(visitor::Visitor &v) override;
33847 
33848  /**
33849  * \brief visit children i.e. member variables of current node using provided
33850  * visitor
33851  *
33852  * Different nodes in the AST have different members (i.e. children). This
33853  * method recursively visits children using provided visitor.
33854  *
33855  * \param v Concrete constant visitor that will be used to recursively visit
33856  * children
33857  *
33858  * \sa Ast::visit_children for example.
33859  */
33860  void visit_children(visitor::ConstVisitor &v) const override;
33861 
33862  /**
33863  * \brief accept (or visit) the current AST node using provided visitor
33864  *
33865  * Instead of visiting children of AST node, like Ast::visit_children,
33866  * accept allows to visit the current node itself using provided concrete
33867  * visitor.
33868  *
33869  * \param v Concrete visitor that will be used to recursively visit node
33870  *
33871  * \sa Ast::accept for example.
33872  */
33873  void accept(visitor::Visitor &v) override;
33874 
33875  /**
33876  * \copydoc accept(visitor::Visitor&)
33877  */
33878  void accept(visitor::ConstVisitor &v) const override;
33879 
33880  /// \}
33881 
33882 private:
33883  /**
33884  * \brief Set this object as parent for all the children
33885  *
33886  * This should be called in every object (with children) constructor
33887  * to set parents. Since it is called only in the constructors it
33888  * should not be virtual to avoid ambiguities (issue #295).
33889  */
33890  void set_parent_in_children();
33891 };
33892 
33893 /** @} */ // end of ast_class
33894 
33895 } // namespace ast
33896 } // namespace nmodl
33897 #endif // !NMODL_AST_EIGEN_LINEAR_SOLVER_BLOCK_HPP
33898 #ifndef NMODL_AST_WRAPPED_EXPRESSION_HPP
33899 #define NMODL_AST_WRAPPED_EXPRESSION_HPP
33900 
33901 namespace nmodl {
33902 namespace ast {
33903 
33904 /**
33905  * @addtogroup ast_class
33906  * @ingroup ast
33907  * @{
33908  */
33909 
33910 /**
33911  * \brief Wrap any other expression type
33912  *
33913  *
33914  */
33916 private:
33917  /// Expression that is being wrapped
33918  std::shared_ptr<Expression> expression;
33919  /// token with location information
33920  std::shared_ptr<ModToken> token;
33921 
33922 public:
33923  /// \name Ctor & dtor
33924  /// \{
33925 
33926  explicit WrappedExpression(Expression *expression);
33927  explicit WrappedExpression(const std::shared_ptr<Expression> &expression);
33929 
33930  virtual ~WrappedExpression() = default;
33931 
33932  /// \}
33933 
33934  /**
33935  * \brief Check if the ast node is an instance of ast::WrappedExpression
33936  * \return true as object is of type ast::WrappedExpression
33937  */
33938  bool is_wrapped_expression() const noexcept override { return true; }
33939 
33940  /**
33941  * \brief Return a copy of the current node
33942  *
33943  * Recursively make a new copy/clone of the current node including
33944  * all members and return a pointer to the node. This is used for
33945  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
33946  * ast.
33947  *
33948  * @return pointer to the clone/copy of the current node
33949  */
33950  WrappedExpression *clone() const override {
33951  return new WrappedExpression(*this);
33952  }
33953 
33954  /// \name Getters
33955  /// \{
33956 
33957  /**
33958  * \brief Return type (ast::AstNodeType) of ast node
33959  *
33960  * Every node in the ast has a type defined in ast::AstNodeType and this
33961  * function is used to retrieve the same.
33962  *
33963  * \return ast node type i.e. ast::AstNodeType::WRAPPED_EXPRESSION
33964  *
33965  * \sa Ast::get_node_type_name
33966  */
33967  AstNodeType get_node_type() const noexcept override {
33969  }
33970 
33971  /**
33972  * \brief Return type (ast::AstNodeType) of ast node as std::string
33973  *
33974  * Every node in the ast has a type defined in ast::AstNodeType.
33975  * This type name can be returned as a std::string for printing
33976  * node to text/json form.
33977  *
33978  * \return name of the node type as a string i.e. "WrappedExpression"
33979  *
33980  * \sa Ast::get_node_name
33981  */
33982  std::string get_node_type_name() const noexcept override {
33983  return "WrappedExpression";
33984  }
33985 
33986  /**
33987  * \brief Get std::shared_ptr from `this` pointer of the current ast node
33988  */
33989  std::shared_ptr<Ast> get_shared_ptr() override {
33990  return std::static_pointer_cast<WrappedExpression>(shared_from_this());
33991  }
33992 
33993  /**
33994  * \brief Get std::shared_ptr from `this` pointer of the current ast node
33995  */
33996  std::shared_ptr<const Ast> get_shared_ptr() const override {
33997  return std::static_pointer_cast<const WrappedExpression>(
33998  shared_from_this());
33999  }
34000 
34001  /**
34002  * \brief Return associated token for the current ast node
34003  *
34004  * Not all ast nodes have token information. For example,
34005  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
34006  * solution of ODEs. In this case, we return nullptr to store in the
34007  * nmodl::symtab::SymbolTable.
34008  *
34009  * \return pointer to token if exist otherwise nullptr
34010  */
34011  const ModToken *get_token() const noexcept override { return token.get(); }
34012 
34013  /**
34014  * \brief Getter for member variable \ref WrappedExpression.expression
34015  */
34016  const std::shared_ptr<Expression> &get_expression() const noexcept {
34017  return expression;
34018  }
34019 
34020  /// \}
34021 
34022  /// \name Setters
34023  /// \{
34024 
34025  /**
34026  * \brief Set token for the current ast node
34027  */
34028  void set_token(const ModToken &tok) {
34029  token = std::make_shared<ModToken>(tok);
34030  }
34031 
34032  /**
34033  * \brief Setter for member variable \ref WrappedExpression.expression (rvalue
34034  * reference)
34035  */
34036  void set_expression(std::shared_ptr<Expression> &&expression);
34037 
34038  /**
34039  * \brief Setter for member variable \ref WrappedExpression.expression
34040  */
34041  void set_expression(const std::shared_ptr<Expression> &expression);
34042 
34043  /// \}
34044 
34045  /// \name Visitor
34046  /// \{
34047 
34048  /**
34049  * \brief visit children i.e. member variables of current node using provided
34050  * visitor
34051  *
34052  * Different nodes in the AST have different members (i.e. children). This
34053  * method recursively visits children using provided visitor.
34054  *
34055  * \param v Concrete visitor that will be used to recursively visit children
34056  *
34057  * \sa Ast::visit_children for example.
34058  */
34059  void visit_children(visitor::Visitor &v) override;
34060 
34061  /**
34062  * \brief visit children i.e. member variables of current node using provided
34063  * visitor
34064  *
34065  * Different nodes in the AST have different members (i.e. children). This
34066  * method recursively visits children using provided visitor.
34067  *
34068  * \param v Concrete constant visitor that will be used to recursively visit
34069  * children
34070  *
34071  * \sa Ast::visit_children for example.
34072  */
34073  void visit_children(visitor::ConstVisitor &v) const override;
34074 
34075  /**
34076  * \brief accept (or visit) the current AST node using provided visitor
34077  *
34078  * Instead of visiting children of AST node, like Ast::visit_children,
34079  * accept allows to visit the current node itself using provided concrete
34080  * visitor.
34081  *
34082  * \param v Concrete visitor that will be used to recursively visit node
34083  *
34084  * \sa Ast::accept for example.
34085  */
34086  void accept(visitor::Visitor &v) override;
34087 
34088  /**
34089  * \copydoc accept(visitor::Visitor&)
34090  */
34091  void accept(visitor::ConstVisitor &v) const override;
34092 
34093  /// \}
34094 
34095 private:
34096  /**
34097  * \brief Set this object as parent for all the children
34098  *
34099  * This should be called in every object (with children) constructor
34100  * to set parents. Since it is called only in the constructors it
34101  * should not be virtual to avoid ambiguities (issue #295).
34102  */
34103  void set_parent_in_children();
34104 };
34105 
34106 /** @} */ // end of ast_class
34107 
34108 } // namespace ast
34109 } // namespace nmodl
34110 #endif // !NMODL_AST_WRAPPED_EXPRESSION_HPP
34111 #ifndef NMODL_AST_DERIVIMPLICIT_CALLBACK_HPP
34112 #define NMODL_AST_DERIVIMPLICIT_CALLBACK_HPP
34113 
34114 namespace nmodl {
34115 namespace ast {
34116 
34117 /**
34118  * @addtogroup ast_class
34119  * @ingroup ast
34120  * @{
34121  */
34122 
34123 /**
34124  * \brief Represent a callback to NEURON's derivimplicit solver
34125  *
34126  *
34127  */
34129 private:
34130  /// Block to be solved (typically derivative)
34131  std::shared_ptr<Block> node_to_solve;
34132  /// token with location information
34133  std::shared_ptr<ModToken> token;
34134 
34135 public:
34136  /// \name Ctor & dtor
34137  /// \{
34138 
34139  explicit DerivimplicitCallback(Block *node_to_solve);
34140  explicit DerivimplicitCallback(const std::shared_ptr<Block> &node_to_solve);
34142 
34143  virtual ~DerivimplicitCallback() = default;
34144 
34145  /// \}
34146 
34147  /**
34148  * \brief Check if the ast node is an instance of ast::DerivimplicitCallback
34149  * \return true as object is of type ast::DerivimplicitCallback
34150  */
34151  bool is_derivimplicit_callback() const noexcept override { return true; }
34152 
34153  /**
34154  * \brief Return a copy of the current node
34155  *
34156  * Recursively make a new copy/clone of the current node including
34157  * all members and return a pointer to the node. This is used for
34158  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
34159  * ast.
34160  *
34161  * @return pointer to the clone/copy of the current node
34162  */
34163  DerivimplicitCallback *clone() const override {
34164  return new DerivimplicitCallback(*this);
34165  }
34166 
34167  /// \name Getters
34168  /// \{
34169 
34170  /**
34171  * \brief Return type (ast::AstNodeType) of ast node
34172  *
34173  * Every node in the ast has a type defined in ast::AstNodeType and this
34174  * function is used to retrieve the same.
34175  *
34176  * \return ast node type i.e. ast::AstNodeType::DERIVIMPLICIT_CALLBACK
34177  *
34178  * \sa Ast::get_node_type_name
34179  */
34180  AstNodeType get_node_type() const noexcept override {
34182  }
34183 
34184  /**
34185  * \brief Return type (ast::AstNodeType) of ast node as std::string
34186  *
34187  * Every node in the ast has a type defined in ast::AstNodeType.
34188  * This type name can be returned as a std::string for printing
34189  * node to text/json form.
34190  *
34191  * \return name of the node type as a string i.e. "DerivimplicitCallback"
34192  *
34193  * \sa Ast::get_node_name
34194  */
34195  std::string get_node_type_name() const noexcept override {
34196  return "DerivimplicitCallback";
34197  }
34198 
34199  /**
34200  * \brief Get std::shared_ptr from `this` pointer of the current ast node
34201  */
34202  std::shared_ptr<Ast> get_shared_ptr() override {
34203  return std::static_pointer_cast<DerivimplicitCallback>(shared_from_this());
34204  }
34205 
34206  /**
34207  * \brief Get std::shared_ptr from `this` pointer of the current ast node
34208  */
34209  std::shared_ptr<const Ast> get_shared_ptr() const override {
34210  return std::static_pointer_cast<const DerivimplicitCallback>(
34211  shared_from_this());
34212  }
34213 
34214  /**
34215  * \brief Return associated token for the current ast node
34216  *
34217  * Not all ast nodes have token information. For example,
34218  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
34219  * solution of ODEs. In this case, we return nullptr to store in the
34220  * nmodl::symtab::SymbolTable.
34221  *
34222  * \return pointer to token if exist otherwise nullptr
34223  */
34224  const ModToken *get_token() const noexcept override { return token.get(); }
34225 
34226  /**
34227  * \brief Getter for member variable \ref DerivimplicitCallback.node_to_solve
34228  */
34229  const std::shared_ptr<Block> &get_node_to_solve() const noexcept {
34230  return node_to_solve;
34231  }
34232 
34233  /// \}
34234 
34235  /// \name Setters
34236  /// \{
34237 
34238  /**
34239  * \brief Set token for the current ast node
34240  */
34241  void set_token(const ModToken &tok) {
34242  token = std::make_shared<ModToken>(tok);
34243  }
34244 
34245  /**
34246  * \brief Setter for member variable \ref DerivimplicitCallback.node_to_solve
34247  * (rvalue reference)
34248  */
34249  void set_node_to_solve(std::shared_ptr<Block> &&node_to_solve);
34250 
34251  /**
34252  * \brief Setter for member variable \ref DerivimplicitCallback.node_to_solve
34253  */
34254  void set_node_to_solve(const std::shared_ptr<Block> &node_to_solve);
34255 
34256  /// \}
34257 
34258  /// \name Visitor
34259  /// \{
34260 
34261  /**
34262  * \brief visit children i.e. member variables of current node using provided
34263  * visitor
34264  *
34265  * Different nodes in the AST have different members (i.e. children). This
34266  * method recursively visits children using provided visitor.
34267  *
34268  * \param v Concrete visitor that will be used to recursively visit children
34269  *
34270  * \sa Ast::visit_children for example.
34271  */
34272  void visit_children(visitor::Visitor &v) override;
34273 
34274  /**
34275  * \brief visit children i.e. member variables of current node using provided
34276  * visitor
34277  *
34278  * Different nodes in the AST have different members (i.e. children). This
34279  * method recursively visits children using provided visitor.
34280  *
34281  * \param v Concrete constant visitor that will be used to recursively visit
34282  * children
34283  *
34284  * \sa Ast::visit_children for example.
34285  */
34286  void visit_children(visitor::ConstVisitor &v) const override;
34287 
34288  /**
34289  * \brief accept (or visit) the current AST node using provided visitor
34290  *
34291  * Instead of visiting children of AST node, like Ast::visit_children,
34292  * accept allows to visit the current node itself using provided concrete
34293  * visitor.
34294  *
34295  * \param v Concrete visitor that will be used to recursively visit node
34296  *
34297  * \sa Ast::accept for example.
34298  */
34299  void accept(visitor::Visitor &v) override;
34300 
34301  /**
34302  * \copydoc accept(visitor::Visitor&)
34303  */
34304  void accept(visitor::ConstVisitor &v) const override;
34305 
34306  /// \}
34307 
34308 private:
34309  /**
34310  * \brief Set this object as parent for all the children
34311  *
34312  * This should be called in every object (with children) constructor
34313  * to set parents. Since it is called only in the constructors it
34314  * should not be virtual to avoid ambiguities (issue #295).
34315  */
34316  void set_parent_in_children();
34317 };
34318 
34319 /** @} */ // end of ast_class
34320 
34321 } // namespace ast
34322 } // namespace nmodl
34323 #endif // !NMODL_AST_DERIVIMPLICIT_CALLBACK_HPP
34324 #ifndef NMODL_AST_SOLUTION_EXPRESSION_HPP
34325 #define NMODL_AST_SOLUTION_EXPRESSION_HPP
34326 
34327 namespace nmodl {
34328 namespace ast {
34329 
34330 /**
34331  * @addtogroup ast_class
34332  * @ingroup ast
34333  * @{
34334  */
34335 
34336 /**
34337  * \brief Represent solution of a block in the AST
34338  *
34339  *
34340  */
34342 private:
34343  ///
34344  std::shared_ptr<SolveBlock> solve_block;
34345  /// Block to be solved (callback node or solution node itself)
34346  std::shared_ptr<Expression> node_to_solve;
34347  /// token with location information
34348  std::shared_ptr<ModToken> token;
34349 
34350 public:
34351  /// \name Ctor & dtor
34352  /// \{
34353 
34354  explicit SolutionExpression(SolveBlock *solve_block,
34355  Expression *node_to_solve);
34356  explicit SolutionExpression(const std::shared_ptr<SolveBlock> &solve_block,
34357  const std::shared_ptr<Expression> &node_to_solve);
34359 
34360  virtual ~SolutionExpression() = default;
34361 
34362  /// \}
34363 
34364  /**
34365  * \brief Check if the ast node is an instance of ast::SolutionExpression
34366  * \return true as object is of type ast::SolutionExpression
34367  */
34368  bool is_solution_expression() const noexcept override { return true; }
34369 
34370  /**
34371  * \brief Return a copy of the current node
34372  *
34373  * Recursively make a new copy/clone of the current node including
34374  * all members and return a pointer to the node. This is used for
34375  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
34376  * ast.
34377  *
34378  * @return pointer to the clone/copy of the current node
34379  */
34380  SolutionExpression *clone() const override {
34381  return new SolutionExpression(*this);
34382  }
34383 
34384  /// \name Getters
34385  /// \{
34386 
34387  /**
34388  * \brief Return type (ast::AstNodeType) of ast node
34389  *
34390  * Every node in the ast has a type defined in ast::AstNodeType and this
34391  * function is used to retrieve the same.
34392  *
34393  * \return ast node type i.e. ast::AstNodeType::SOLUTION_EXPRESSION
34394  *
34395  * \sa Ast::get_node_type_name
34396  */
34397  AstNodeType get_node_type() const noexcept override {
34399  }
34400 
34401  /**
34402  * \brief Return type (ast::AstNodeType) of ast node as std::string
34403  *
34404  * Every node in the ast has a type defined in ast::AstNodeType.
34405  * This type name can be returned as a std::string for printing
34406  * node to text/json form.
34407  *
34408  * \return name of the node type as a string i.e. "SolutionExpression"
34409  *
34410  * \sa Ast::get_node_name
34411  */
34412  std::string get_node_type_name() const noexcept override {
34413  return "SolutionExpression";
34414  }
34415 
34416  /**
34417  * \brief Get std::shared_ptr from `this` pointer of the current ast node
34418  */
34419  std::shared_ptr<Ast> get_shared_ptr() override {
34420  return std::static_pointer_cast<SolutionExpression>(shared_from_this());
34421  }
34422 
34423  /**
34424  * \brief Get std::shared_ptr from `this` pointer of the current ast node
34425  */
34426  std::shared_ptr<const Ast> get_shared_ptr() const override {
34427  return std::static_pointer_cast<const SolutionExpression>(
34428  shared_from_this());
34429  }
34430 
34431  /**
34432  * \brief Return associated token for the current ast node
34433  *
34434  * Not all ast nodes have token information. For example,
34435  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
34436  * solution of ODEs. In this case, we return nullptr to store in the
34437  * nmodl::symtab::SymbolTable.
34438  *
34439  * \return pointer to token if exist otherwise nullptr
34440  */
34441  const ModToken *get_token() const noexcept override { return token.get(); }
34442 
34443  /**
34444  * \brief Getter for member variable \ref SolutionExpression.solve_block
34445  */
34446  const std::shared_ptr<SolveBlock> &get_solve_block() const noexcept {
34447  return solve_block;
34448  }
34449 
34450  /**
34451  * \brief Getter for member variable \ref SolutionExpression.node_to_solve
34452  */
34453  const std::shared_ptr<Expression> &get_node_to_solve() const noexcept {
34454  return node_to_solve;
34455  }
34456 
34457  /// \}
34458 
34459  /// \name Setters
34460  /// \{
34461 
34462  /**
34463  * \brief Set token for the current ast node
34464  */
34465  void set_token(const ModToken &tok) {
34466  token = std::make_shared<ModToken>(tok);
34467  }
34468 
34469  /**
34470  * \brief Setter for member variable \ref SolutionExpression.solve_block
34471  * (rvalue reference)
34472  */
34473  void set_solve_block(std::shared_ptr<SolveBlock> &&solve_block);
34474 
34475  /**
34476  * \brief Setter for member variable \ref SolutionExpression.solve_block
34477  */
34478  void set_solve_block(const std::shared_ptr<SolveBlock> &solve_block);
34479 
34480  /**
34481  * \brief Setter for member variable \ref SolutionExpression.node_to_solve
34482  * (rvalue reference)
34483  */
34484  void set_node_to_solve(std::shared_ptr<Expression> &&node_to_solve);
34485 
34486  /**
34487  * \brief Setter for member variable \ref SolutionExpression.node_to_solve
34488  */
34489  void set_node_to_solve(const std::shared_ptr<Expression> &node_to_solve);
34490 
34491  /// \}
34492 
34493  /// \name Visitor
34494  /// \{
34495 
34496  /**
34497  * \brief visit children i.e. member variables of current node using provided
34498  * visitor
34499  *
34500  * Different nodes in the AST have different members (i.e. children). This
34501  * method recursively visits children using provided visitor.
34502  *
34503  * \param v Concrete visitor that will be used to recursively visit children
34504  *
34505  * \sa Ast::visit_children for example.
34506  */
34507  void visit_children(visitor::Visitor &v) override;
34508 
34509  /**
34510  * \brief visit children i.e. member variables of current node using provided
34511  * visitor
34512  *
34513  * Different nodes in the AST have different members (i.e. children). This
34514  * method recursively visits children using provided visitor.
34515  *
34516  * \param v Concrete constant visitor that will be used to recursively visit
34517  * children
34518  *
34519  * \sa Ast::visit_children for example.
34520  */
34521  void visit_children(visitor::ConstVisitor &v) const override;
34522 
34523  /**
34524  * \brief accept (or visit) the current AST node using provided visitor
34525  *
34526  * Instead of visiting children of AST node, like Ast::visit_children,
34527  * accept allows to visit the current node itself using provided concrete
34528  * visitor.
34529  *
34530  * \param v Concrete visitor that will be used to recursively visit node
34531  *
34532  * \sa Ast::accept for example.
34533  */
34534  void accept(visitor::Visitor &v) override;
34535 
34536  /**
34537  * \copydoc accept(visitor::Visitor&)
34538  */
34539  void accept(visitor::ConstVisitor &v) const override;
34540 
34541  /// \}
34542 
34543 private:
34544  /**
34545  * \brief Set this object as parent for all the children
34546  *
34547  * This should be called in every object (with children) constructor
34548  * to set parents. Since it is called only in the constructors it
34549  * should not be virtual to avoid ambiguities (issue #295).
34550  */
34551  void set_parent_in_children();
34552 };
34553 
34554 /** @} */ // end of ast_class
34555 
34556 } // namespace ast
34557 } // namespace nmodl
34558 #endif // !NMODL_AST_SOLUTION_EXPRESSION_HPP
34559 #ifndef NMODL_AST_UPDATE_DT_HPP
34560 #define NMODL_AST_UPDATE_DT_HPP
34561 
34562 namespace nmodl {
34563 namespace ast {
34564 
34565 /**
34566  * @addtogroup ast_class
34567  * @ingroup ast
34568  * @{
34569  */
34570 
34571 /**
34572  * \brief Statement to indicate a change in timestep in a given block
34573  *
34574  *
34575  */
34576 class UpdateDt : public Statement {
34577 private:
34578  /// Value of new timestep
34579  std::shared_ptr<Double> value;
34580  /// token with location information
34581  std::shared_ptr<ModToken> token;
34582 
34583 public:
34584  /// \name Ctor & dtor
34585  /// \{
34586 
34587  explicit UpdateDt(Double *value);
34588  explicit UpdateDt(const std::shared_ptr<Double> &value);
34589  UpdateDt(const UpdateDt &obj);
34590 
34591  virtual ~UpdateDt() = default;
34592 
34593  /// \}
34594 
34595  /**
34596  * \brief Check if the ast node is an instance of ast::UpdateDt
34597  * \return true as object is of type ast::UpdateDt
34598  */
34599  bool is_update_dt() const noexcept override { return true; }
34600 
34601  /**
34602  * \brief Return a copy of the current node
34603  *
34604  * Recursively make a new copy/clone of the current node including
34605  * all members and return a pointer to the node. This is used for
34606  * passes like nmodl::visitor::InlineVisitor where nodes are cloned in the
34607  * ast.
34608  *
34609  * @return pointer to the clone/copy of the current node
34610  */
34611  UpdateDt *clone() const override { return new UpdateDt(*this); }
34612 
34613  /// \name Getters
34614  /// \{
34615 
34616  /**
34617  * \brief Return type (ast::AstNodeType) of ast node
34618  *
34619  * Every node in the ast has a type defined in ast::AstNodeType and this
34620  * function is used to retrieve the same.
34621  *
34622  * \return ast node type i.e. ast::AstNodeType::UPDATE_DT
34623  *
34624  * \sa Ast::get_node_type_name
34625  */
34626  AstNodeType get_node_type() const noexcept override {
34627  return AstNodeType::UPDATE_DT;
34628  }
34629 
34630  /**
34631  * \brief Return type (ast::AstNodeType) of ast node as std::string
34632  *
34633  * Every node in the ast has a type defined in ast::AstNodeType.
34634  * This type name can be returned as a std::string for printing
34635  * node to text/json form.
34636  *
34637  * \return name of the node type as a string i.e. "UpdateDt"
34638  *
34639  * \sa Ast::get_node_name
34640  */
34641  std::string get_node_type_name() const noexcept override {
34642  return "UpdateDt";
34643  }
34644 
34645  /**
34646  * \brief Return NMODL statement of ast node as std::string
34647  *
34648  * Every node is related to a special statement in the NMODL. This
34649  * statement can be returned as a std::string for printing to
34650  * text/json form.
34651  *
34652  * \return name of the statement as a string i.e. "dt"
34653  *
34654  * \sa Ast::get_nmodl_name
34655  */
34656  std::string get_nmodl_name() const noexcept override { return "dt"; }
34657 
34658  /**
34659  * \brief Get std::shared_ptr from `this` pointer of the current ast node
34660  */
34661  std::shared_ptr<Ast> get_shared_ptr() override {
34662  return std::static_pointer_cast<UpdateDt>(shared_from_this());
34663  }
34664 
34665  /**
34666  * \brief Get std::shared_ptr from `this` pointer of the current ast node
34667  */
34668  std::shared_ptr<const Ast> get_shared_ptr() const override {
34669  return std::static_pointer_cast<const UpdateDt>(shared_from_this());
34670  }
34671 
34672  /**
34673  * \brief Return associated token for the current ast node
34674  *
34675  * Not all ast nodes have token information. For example,
34676  * nmodl::visitor::NeuronSolveVisitor can insert new nodes in the ast as a
34677  * solution of ODEs. In this case, we return nullptr to store in the
34678  * nmodl::symtab::SymbolTable.
34679  *
34680  * \return pointer to token if exist otherwise nullptr
34681  */
34682  const ModToken *get_token() const noexcept override { return token.get(); }
34683 
34684  /**
34685  * \brief Getter for member variable \ref UpdateDt.value
34686  */
34687  const std::shared_ptr<Double> &get_value() const noexcept { return value; }
34688 
34689  /// \}
34690 
34691  /// \name Setters
34692  /// \{
34693 
34694  /**
34695  * \brief Set token for the current ast node
34696  */
34697  void set_token(const ModToken &tok) {
34698  token = std::make_shared<ModToken>(tok);
34699  }
34700 
34701  /**
34702  * \brief Setter for member variable \ref UpdateDt.value (rvalue reference)
34703  */
34704  void set_value(std::shared_ptr<Double> &&value);
34705 
34706  /**
34707  * \brief Setter for member variable \ref UpdateDt.value
34708  */
34709  void set_value(const std::shared_ptr<Double> &value);
34710 
34711  /// \}
34712 
34713  /// \name Visitor
34714  /// \{
34715 
34716  /**
34717  * \brief visit children i.e. member variables of current node using provided
34718  * visitor
34719  *
34720  * Different nodes in the AST have different members (i.e. children). This
34721  * method recursively visits children using provided visitor.
34722  *
34723  * \param v Concrete visitor that will be used to recursively visit children
34724  *
34725  * \sa Ast::visit_children for example.
34726  */
34727  void visit_children(visitor::Visitor &v) override;
34728 
34729  /**
34730  * \brief visit children i.e. member variables of current node using provided
34731  * visitor
34732  *
34733  * Different nodes in the AST have different members (i.e. children). This
34734  * method recursively visits children using provided visitor.
34735  *
34736  * \param v Concrete constant visitor that will be used to recursively visit
34737  * children
34738  *
34739  * \sa Ast::visit_children for example.
34740  */
34741  void visit_children(visitor::ConstVisitor &v) const override;
34742 
34743  /**
34744  * \brief accept (or visit) the current AST node using provided visitor
34745  *
34746  * Instead of visiting children of AST node, like Ast::visit_children,
34747  * accept allows to visit the current node itself using provided concrete
34748  * visitor.
34749  *
34750  * \param v Concrete visitor that will be used to recursively visit node
34751  *
34752  * \sa Ast::accept for example.
34753  */
34754  void accept(visitor::Visitor &v) override;
34755 
34756  /**
34757  * \copydoc accept(visitor::Visitor&)
34758  */
34759  void accept(visitor::ConstVisitor &v) const override;
34760 
34761  /// \}
34762 
34763 private:
34764  /**
34765  * \brief Set this object as parent for all the children
34766  *
34767  * This should be called in every object (with children) constructor
34768  * to set parents. Since it is called only in the constructors it
34769  * should not be virtual to avoid ambiguities (issue #295).
34770  */
34771  void set_parent_in_children();
34772 };
34773 
34774 /** @} */ // end of ast_class
34775 
34776 } // namespace ast
34777 } // namespace nmodl
34778 #endif // !NMODL_AST_UPDATE_DT_HPP
34779 
34780 namespace nmodl {
34781 namespace ast {
34782 #ifdef NMODL_AST_ASSIGNED_BLOCK_HPP_INLINE_DEFINITION_REQUIRED
34783 
34784 /**
34785  * \brief Insert members to definitions
34786  */
34787 template <class NodeType, class InputIterator>
34789  AssignedDefinitionVector::const_iterator position, NodeType &to,
34790  InputIterator first, InputIterator last) {
34791 
34792  for (auto it = first; it != last; ++it) {
34793  auto &n = *it;
34794  // set parents
34795  n->set_parent(this);
34796  }
34797  auto pos_it = const_iter_cast(definitions, position);
34798  auto first_it = const_iter_cast(to, first);
34799  auto last_it = const_iter_cast(to, last);
34800  definitions.insert(pos_it, first_it, last_it);
34801 }
34802 
34803 #endif // !NMODL_AST_ASSIGNED_BLOCK_HPP_INLINE_DEFINITION_REQUIRED
34804 
34805 #ifdef NMODL_AST_STATEMENT_BLOCK_HPP_INLINE_DEFINITION_REQUIRED
34806 
34807 /**
34808  * \brief Insert members to statements
34809  */
34810 template <class NodeType, class InputIterator>
34811 void StatementBlock::insert_statement(StatementVector::const_iterator position,
34812  NodeType &to, InputIterator first,
34813  InputIterator last) {
34814 
34815  for (auto it = first; it != last; ++it) {
34816  auto &n = *it;
34817  // set parents
34818  n->set_parent(this);
34819  }
34820  auto pos_it = const_iter_cast(statements, position);
34821  auto first_it = const_iter_cast(to, first);
34822  auto last_it = const_iter_cast(to, last);
34823  statements.insert(pos_it, first_it, last_it);
34824 }
34825 
34826 #endif // !NMODL_AST_STATEMENT_BLOCK_HPP_INLINE_DEFINITION_REQUIRED
34827 
34828 #ifdef NMODL_AST_LOCAL_LIST_STATEMENT_HPP_INLINE_DEFINITION_REQUIRED
34829 
34830 /**
34831  * \brief Insert members to variables
34832  */
34833 template <class NodeType, class InputIterator>
34835  LocalVarVector::const_iterator position, NodeType &to, InputIterator first,
34836  InputIterator last) {
34837 
34838  for (auto it = first; it != last; ++it) {
34839  auto &n = *it;
34840  // set parents
34841  n->set_parent(this);
34842  }
34843  auto pos_it = const_iter_cast(variables, position);
34844  auto first_it = const_iter_cast(to, first);
34845  auto last_it = const_iter_cast(to, last);
34846  variables.insert(pos_it, first_it, last_it);
34847 }
34848 
34849 #endif // !NMODL_AST_LOCAL_LIST_STATEMENT_HPP_INLINE_DEFINITION_REQUIRED
34850 
34851 #ifdef NMODL_AST_WATCH_STATEMENT_HPP_INLINE_DEFINITION_REQUIRED
34852 
34853 /**
34854  * \brief Insert members to statements
34855  */
34856 template <class NodeType, class InputIterator>
34857 void WatchStatement::insert_watch(WatchVector::const_iterator position,
34858  NodeType &to, InputIterator first,
34859  InputIterator last) {
34860 
34861  for (auto it = first; it != last; ++it) {
34862  auto &n = *it;
34863  // set parents
34864  n->set_parent(this);
34865  }
34866  auto pos_it = const_iter_cast(statements, position);
34867  auto first_it = const_iter_cast(to, first);
34868  auto last_it = const_iter_cast(to, last);
34869  statements.insert(pos_it, first_it, last_it);
34870 }
34871 
34872 #endif // !NMODL_AST_WATCH_STATEMENT_HPP_INLINE_DEFINITION_REQUIRED
34873 
34874 #ifdef NMODL_AST_GLOBAL_HPP_INLINE_DEFINITION_REQUIRED
34875 
34876 /**
34877  * \brief Insert members to variables
34878  */
34879 template <class NodeType, class InputIterator>
34880 void Global::insert_global_var(GlobalVarVector::const_iterator position,
34881  NodeType &to, InputIterator first,
34882  InputIterator last) {
34883 
34884  for (auto it = first; it != last; ++it) {
34885  auto &n = *it;
34886  // set parents
34887  n->set_parent(this);
34888  }
34889  auto pos_it = const_iter_cast(variables, position);
34890  auto first_it = const_iter_cast(to, first);
34891  auto last_it = const_iter_cast(to, last);
34892  variables.insert(pos_it, first_it, last_it);
34893 }
34894 
34895 #endif // !NMODL_AST_GLOBAL_HPP_INLINE_DEFINITION_REQUIRED
34896 
34897 #ifdef NMODL_AST_PROGRAM_HPP_INLINE_DEFINITION_REQUIRED
34898 
34899 /**
34900  * \brief Insert members to blocks
34901  */
34902 template <class NodeType, class InputIterator>
34903 void Program::insert_node(NodeVector::const_iterator position, NodeType &to,
34904  InputIterator first, InputIterator last) {
34905 
34906  for (auto it = first; it != last; ++it) {
34907  auto &n = *it;
34908  // set parents
34909  n->set_parent(this);
34910  }
34911  auto pos_it = const_iter_cast(blocks, position);
34912  auto first_it = const_iter_cast(to, first);
34913  auto last_it = const_iter_cast(to, last);
34914  blocks.insert(pos_it, first_it, last_it);
34915 }
34916 
34917 #endif // !NMODL_AST_PROGRAM_HPP_INLINE_DEFINITION_REQUIRED
34918 
34919 } // namespace ast
34920 } // namespace nmodl
std::string get_nmodl_name() const noexcept override
Return NMODL statement of ast node as std::string.
Definition: all.hpp:25741
std::string get_nmodl_name() const noexcept override
Return NMODL statement of ast node as std::string.
Definition: all.hpp:18007
type of ast::DiscreteBlock
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:14314
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:13050
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:16214
std::string get_nmodl_name() const noexcept override
Return NMODL statement of ast node as std::string.
Definition: all.hpp:14344
std::vector< std::shared_ptr< ExternVar > > ExternVarVector
Definition: ast_decl.hpp:361
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:24126
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:16376
std::shared_ptr< StatementBlock > ifsolerr
Block to be executed on error.
Definition: all.hpp:11575
static const std::string ReactionOpNames[]
string representation of ast::ReactionOp
Definition: ast_common.hpp:107
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:10973
std::shared_ptr< Name > steadystate
Name of the integration method.
Definition: all.hpp:11573
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:22365
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:2438
std::shared_ptr< Expression > length
legth of an array or index position
Definition: all.hpp:2686
const std::shared_ptr< Integer > & get_with() const noexcept
Getter for member variable TableStatement::with.
Definition: all.hpp:28959
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:5265
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:18232
ThreadsafeVar * clone() const override
Return a copy of the current node.
Definition: all.hpp:5914
virtual AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:387
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:5958
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:6460
std::shared_ptr< StatementBlock > statement_block
TODO.
Definition: all.hpp:24903
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:13274
type of ast::ConductanceHint
bool is_lag_statement() const noexcept override
Check if the ast node is an instance of ast::LagStatement.
Definition: all.hpp:28158
bool is_constant_statement() const noexcept override
Check if the ast node is an instance of ast::ConstantStatement.
Definition: all.hpp:28625
const NameVector & get_solvefor() const noexcept
Getter for member variable LinearBlock::solvefor.
Definition: all.hpp:9289
GlobalVarVector::const_iterator insert_global_var(GlobalVarVector::const_iterator position, const std::shared_ptr< GlobalVar > &n)
Insert member to variables.
Definition: ast.cpp:12831
LocalListStatement * clone() const override
Return a copy of the current node.
Definition: all.hpp:20739
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:6180
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:12717
Represents SECTION variables statement in NMODL.
Definition: all.hpp:30108
type of ast::WrappedExpression
type of ast::NrnStateBlock
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:5780
const std::shared_ptr< Expression > & get_value() const noexcept
Getter for member variable Watch::value.
Definition: all.hpp:18967
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:10754
std::shared_ptr< Name > name
Name of the discrete block.
Definition: all.hpp:9761
static const std::string BATypeNames[]
string representation of ast::BAType
Definition: ast_common.hpp:95
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:19183
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:32367
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:9527
const std::shared_ptr< StatementBlock > & get_setup_x_block() const noexcept
Getter for member variable EigenLinearSolverBlock::setup_x_block.
Definition: all.hpp:33709
bool is_unary_operator() const noexcept override
Check if the ast node is an instance of ast::UnaryOperator.
Definition: all.hpp:16607
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:16451
std::string get_nmodl_name() const noexcept override
Return NMODL statement of ast node as std::string.
Definition: all.hpp:24983
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:28878
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:25505
std::shared_ptr< Unit > unit
TODO.
Definition: all.hpp:22219
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:34348
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:3246
symtab::SymbolTable * get_symbol_table() const override
Return associated symbol table for the current ast node.
Definition: all.hpp:9266
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:32886
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:5294
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:4634
const std::shared_ptr< Identifier > & get_name() const noexcept
Getter for member variable Match::name.
Definition: all.hpp:19400
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:5088
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:6481
std::string get_nmodl_name() const noexcept override
Return NMODL statement of ast node as std::string.
Definition: all.hpp:34656
const std::shared_ptr< Name > & get_name2() const noexcept
Getter for member variable PartialBoundary::name2.
Definition: all.hpp:25806
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:29119
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:21777
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:31126
bool is_non_linear_block() const noexcept override
Check if the ast node is an instance of ast::NonLinearBlock.
Definition: all.hpp:9485
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:4413
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:34581
bool is_reaction_operator() const noexcept override
Check if the ast node is an instance of ast::ReactionOperator.
Definition: all.hpp:16819
const SteppedVector & get_statements() const noexcept
Getter for member variable StepBlock::statements.
Definition: all.hpp:6499
AssignedDefinitionVector::const_iterator insert_assigned_definition(AssignedDefinitionVector::const_iterator position, const std::shared_ptr< AssignedDefinition > &n)
Insert member to definitions.
Definition: ast.cpp:2415
const std::shared_ptr< StatementBlock > & get_finalize_block() const noexcept
Getter for member variable EigenLinearSolverBlock::finalize_block.
Definition: all.hpp:33726
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:24454
Double * clone() const override
Return a copy of the current node.
Definition: all.hpp:1751
const std::shared_ptr< String > & get_statement() const noexcept
Getter for member variable LineComment::statement.
Definition: all.hpp:32027
virtual Block * clone() const override
Return a copy of the current node.
Definition: all.hpp:533
virtual AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:84
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:19989
std::string get_nmodl_name() const noexcept override
Return NMODL statement of ast node as std::string.
Definition: all.hpp:10419
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:29239
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:21073
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:20543
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:34209
type of ast::FunctionCall
const std::shared_ptr< Name > & get_name() const noexcept
Getter for member variable DiscreteBlock::name.
Definition: all.hpp:9901
type of ast::EigenLinearSolverBlock
AstNodeType
Enum type for every AST node type.
Definition: ast_decl.hpp:183
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:26708
UnaryOp
enum type for unary operators
Definition: ast_common.hpp:74
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:31104
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:6425
virtual void accept(visitor::Visitor &v) override
accept (or visit) the current AST node using provided visitor
Definition: ast.cpp:357
std::shared_ptr< SolveBlock > solve_block
Definition: all.hpp:34344
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:2242
Limits * clone() const override
Return a copy of the current node.
Definition: all.hpp:15482
ExpressionStatement * clone() const override
Return a copy of the current node.
Definition: all.hpp:23398
std::string get_nmodl_name() const noexcept override
Return NMODL statement of ast node as std::string.
Definition: all.hpp:18247
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:13620
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:12468
std::shared_ptr< Name > name
Name of the non-linear block.
Definition: all.hpp:9456
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:15229
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:13841
bool is_param_assign() const noexcept override
Check if the ast node is an instance of ast::ParamAssign.
Definition: all.hpp:21721
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:1534
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:5220
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:22966
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:26900
Compartment * clone() const override
Return a copy of the current node.
Definition: all.hpp:27334
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:17081
std::shared_ptr< Name > name
Name of the linear block.
Definition: all.hpp:9141
const NonspecificCurVarVector & get_currents() const noexcept
Getter for member variable Nonspecific::currents.
Definition: all.hpp:29770
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:33346
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:20988
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:4399
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:20771
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:18217
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:1281
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:21579
std::shared_ptr< Unit > unit
Unit if specified.
Definition: all.hpp:10335
Represent token returned by scanner.
Definition: modtoken.hpp:50
std::string get_nmodl_name() const noexcept override
Return NMODL statement of ast node as std::string.
Definition: all.hpp:23658
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:32262
Range * clone() const override
Return a copy of the current node.
Definition: all.hpp:30359
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:17748
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:25475
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:19608
bool is_neuron_block() const noexcept override
Check if the ast node is an instance of ast::NeuronBlock.
Definition: all.hpp:14553
const std::shared_ptr< StatementBlock > & get_finalize_block() const noexcept
Getter for member variable EigenNewtonSolverBlock::finalize_block.
Definition: all.hpp:33334
Represents a LAG statement in the mod file.
Definition: all.hpp:28132
Base class for all Abstract Syntax Tree node types.
Definition: ast.hpp:72
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:11039
std::string get_nmodl_name() const noexcept override
Return NMODL statement of ast node as std::string.
Definition: all.hpp:31563
std::shared_ptr< Integer > with
an increment factor
Definition: all.hpp:28826
std::string get_nmodl_name() const noexcept override
Return NMODL statement of ast node as std::string.
Definition: all.hpp:31343
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:21699
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:29887
bool is_watch() const noexcept override
Check if the ast node is an instance of ast::Watch.
Definition: all.hpp:18887
const std::shared_ptr< Unit > & get_unit2() const noexcept
Getter for member variable FactorDef::unit2.
Definition: all.hpp:20122
std::string get_nmodl_name() const noexcept override
Return NMODL statement of ast node as std::string.
Definition: all.hpp:30185
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:16252
const std::shared_ptr< Unit > & get_unit() const noexcept
Getter for member variable ParamAssign::unit.
Definition: all.hpp:21819
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:5441
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:2936
const std::shared_ptr< StatementBlock > & get_statement_block() const noexcept override
Getter for member variable IfStatement::statement_block.
Definition: all.hpp:24740
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:34202
Represents LINEAR block in the NMODL.
Definition: all.hpp:9138
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:3506
DerivimplicitCallback * clone() const override
Return a copy of the current node.
Definition: all.hpp:34163
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:6682
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:8631
Represents SUFFIX statement in NMODL.
Definition: all.hpp:29112
std::string get_nmodl_name() const noexcept override
Return NMODL statement of ast node as std::string.
Definition: all.hpp:30402
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:17059
void set_symbol_table(symtab::SymbolTable *newsymtab) override
Set symbol table for the current ast node.
Definition: all.hpp:6264
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:27879
PartialEquation * clone() const override
Return a copy of the current node.
Definition: all.hpp:25417
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:13890
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:9765
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:16437
static const std::string BinaryOpNames[]
string representation of ast::BinaryOp
Definition: ast_common.hpp:70
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:23670
std::vector< std::shared_ptr< ThreadsafeVar > > ThreadsafeVarVector
Definition: ast_decl.hpp:362
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:26560
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:29180
DerivativeBlock * clone() const override
Return a copy of the current node.
Definition: all.hpp:8879
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:18416
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:33018
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:13230
std::string get_nmodl_name() const noexcept override
Return NMODL statement of ast node as std::string.
Definition: all.hpp:28215
bool is_ba_block() const noexcept override
Check if the ast node is an instance of ast::BABlock.
Definition: all.hpp:12946
std::vector< std::shared_ptr< PointerVar > > PointerVarVector
Definition: ast_decl.hpp:359
const ArgumentVector & get_parameters() const noexcept override
Getter for member variable ForNetcon::parameters.
Definition: all.hpp:13306
type of ast::ForAllStatement
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:32039
const std::shared_ptr< Expression > & get_length() const noexcept
Getter for member variable IndexedName::length.
Definition: all.hpp:2800
bool is_line_comment() const noexcept override
Check if the ast node is an instance of ast::LineComment.
Definition: all.hpp:31952
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:13760
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:3268
const std::shared_ptr< Name > & get_name() const noexcept
Getter for member variable FactorDef::name.
Definition: all.hpp:20102
std::shared_ptr< Expression > increment
TODO.
Definition: all.hpp:23810
Represents TABLE statement in NMODL.
Definition: all.hpp:28815
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:10155
const std::shared_ptr< Expression > & get_condition() const noexcept
Getter for member variable ElseIfStatement::condition.
Definition: all.hpp:25014
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:22618
const ParamAssignVector & get_statements() const noexcept
Getter for member variable ParamBlock::statements.
Definition: all.hpp:6239
std::shared_ptr< String > statement
comment text
Definition: all.hpp:32142
std::shared_ptr< StatementBlock > statement_block
TODO.
Definition: all.hpp:24124
bool is_partial_equation() const noexcept override
Check if the ast node is an instance of ast::PartialEquation.
Definition: all.hpp:25405
Represent a callback to NEURON&#39;s derivimplicit solver.
Definition: all.hpp:34128
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:4115
Represent queue statement in NMODL.
Definition: all.hpp:28371
bool is_for_netcon() const noexcept override
Check if the ast node is an instance of ast::ForNetcon.
Definition: all.hpp:13203
std::shared_ptr< Expression > lhs
TODO.
Definition: all.hpp:17927
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:32245
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:6509
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:16480
bool is_react_var_name() const noexcept override
Check if the ast node is an instance of ast::ReactVarName.
Definition: all.hpp:3457
const std::shared_ptr< Name > & get_type() const noexcept
Getter for member variable Suffix::type.
Definition: all.hpp:29211
const ArgumentVector & get_parameters() const noexcept override
Getter for member variable FunctionTableBlock::parameters.
Definition: all.hpp:10484
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:21518
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:21748
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:1266
NonLinEquation * clone() const override
Return a copy of the current node.
Definition: all.hpp:17962
type of ast::ConstantVar
virtual std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:883
NodeVector blocks
Vector of top level blocks in the mod file.
Definition: all.hpp:32592
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:31711
const std::shared_ptr< Number > & get_from() const noexcept
Getter for member variable AssignedDefinition::from.
Definition: all.hpp:22675
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:17487
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:28654
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:19168
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:15945
type of ast::PointerVar
std::shared_ptr< Integer > value
Value of the macro.
Definition: all.hpp:21206
std::shared_ptr< String > value
Value of name.
Definition: all.hpp:2193
type of ast::PartialBlock
Float * clone() const override
Return a copy of the current node.
Definition: all.hpp:1504
std::string get_nmodl_name() const noexcept override
Return NMODL statement of ast node as std::string.
Definition: all.hpp:9227
std::shared_ptr< Identifier > name
TODO.
Definition: all.hpp:25643
type of ast::BreakpointBlock
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:5336
virtual std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:723
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:24687
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:10448
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:17242
std::shared_ptr< Expression > expression
TODO.
Definition: all.hpp:27557
std::shared_ptr< Expression > expression
TODO.
Definition: all.hpp:17700
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:26733
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:29445
std::shared_ptr< StatementBlock > statement_block
Block with statements vector.
Definition: all.hpp:10049
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:25034
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:4191
std::string get_nmodl_name() const noexcept override
Return NMODL statement of ast node as std::string.
Definition: all.hpp:33240
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:34133
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:29970
const ElseIfStatementVector & get_elseifs() const noexcept
Getter for member variable IfStatement::elseifs.
Definition: all.hpp:24748
std::string get_nmodl_name() const noexcept override
Return NMODL statement of ast node as std::string.
Definition: all.hpp:30620
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:25271
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:5060
std::shared_ptr< StatementBlock > initialize_block
Statement block to be executed before calling newton solver.
Definition: all.hpp:33138
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:23814
std::shared_ptr< StatementBlock > statement_block
Block with statements vector.
Definition: all.hpp:7732
symtab::SymbolTable * get_symbol_table() const override
Return associated symbol table for the current ast node.
Definition: all.hpp:10168
void set_symbol_table(symtab::SymbolTable *newsymtab) override
Set symbol table for the current ast node.
Definition: all.hpp:10514
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:2508
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:28261
Represents a variable.
Definition: all.hpp:2927
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:18019
bool is_match_block() const noexcept override
Check if the ast node is an instance of ast::MatchBlock.
Definition: all.hpp:13779
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:14622
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:32769
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:6719
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:11981
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:5488
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:11663
const std::shared_ptr< Name > & get_type() const noexcept
Getter for member variable Valence::type.
Definition: all.hpp:20370
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:3003
type of ast::ExpressionStatement
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:17595
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:10433
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:2021
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:2501
const std::shared_ptr< StatementBlock > & get_functor_block() const noexcept
Getter for member variable EigenNewtonSolverBlock::functor_block.
Definition: all.hpp:33317
const std::shared_ptr< StatementBlock > & get_ifsolerr() const noexcept
Getter for member variable SolveBlock::ifsolerr.
Definition: all.hpp:11721
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:4184
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:10740
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:34441
UnaryOp value
TODO.
Definition: all.hpp:16586
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:28969
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:5664
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:33738
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:15538
bool is_queue_expression_type() const noexcept override
Check if the ast node is an instance of ast::QueueExpressionType.
Definition: all.hpp:19110
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:12752
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:8363
void set_symbol_table(symtab::SymbolTable *newsymtab) override
Set symbol table for the current ast node.
Definition: all.hpp:33751
WatchStatement * clone() const override
Return a copy of the current node.
Definition: all.hpp:26033
bool is_lin_equation() const noexcept override
Check if the ast node is an instance of ast::LinEquation.
Definition: all.hpp:18190
type of ast::IndependentBlock
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:23209
External * clone() const override
Return a copy of the current node.
Definition: all.hpp:31298
NumberVector values
TODO.
Definition: all.hpp:21968
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:25746
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:25232
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:24623
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:23684
type of ast::LocalListStatement
type of ast::ReactionStatement
const std::shared_ptr< StatementBlock > & get_statement_block() const noexcept override
Getter for member variable DerivativeBlock::statement_block.
Definition: all.hpp:8986
void set_symbol_table(symtab::SymbolTable *newsymtab) override
Set symbol table for the current ast node.
Definition: all.hpp:33031
type of ast::ElseIfStatement
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:8000
std::shared_ptr< Expression > left_linxpression
TODO.
Definition: all.hpp:18167
void negate() override
Negate the value of current ast node.
Definition: all.hpp:1896
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:2756
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:12453
ConstructorBlock * clone() const override
Return a copy of the current node.
Definition: all.hpp:8033
const std::shared_ptr< StatementBlock > & get_statement_block() const noexcept override
Getter for member variable ConstructorBlock::statement_block.
Definition: all.hpp:8126
const std::shared_ptr< Identifier > & get_name() const noexcept
Getter for member variable PlotVar::name.
Definition: all.hpp:15991
virtual std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:106
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:34465
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:27921
symtab::SymbolTable * get_symbol_table() const override
Return associated symbol table for the current ast node.
Definition: all.hpp:13579
Represents specific element of an array variable.
Definition: all.hpp:2681
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:8617
std::shared_ptr< String > value
Name of prime variable.
Definition: all.hpp:2434
QueueStatement * clone() const override
Return a copy of the current node.
Definition: all.hpp:28409
std::shared_ptr< Integer > value
TODO.
Definition: all.hpp:3434
NonspecificCurVar * clone() const override
Return a copy of the current node.
Definition: all.hpp:4145
std::shared_ptr< Integer > n_state_vars
number of state vars used in solve
Definition: all.hpp:33134
bool is_before_block() const noexcept override
Check if the ast node is an instance of ast::BeforeBlock.
Definition: all.hpp:12426
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:26090
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:15972
bool is_partial_block() const noexcept override
Check if the ast node is an instance of ast::PartialBlock.
Definition: all.hpp:10072
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:13552
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:3983
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:25253
void set_symbol_table(symtab::SymbolTable *newsymtab) override
Set symbol table for the current ast node.
Definition: all.hpp:13633
bool is_number() const noexcept override
Check if the ast node is an instance of ast::Number.
Definition: all.hpp:834
symtab::SymbolTable * get_symbol_table() const override
Return associated symbol table for the current ast node.
Definition: all.hpp:12522
const std::shared_ptr< StatementBlock > & get_variable_block() const noexcept
Getter for member variable EigenLinearSolverBlock::variable_block.
Definition: all.hpp:33694
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:12988
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:20385
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:15303
const std::shared_ptr< StatementBlock > & get_statement_block() const noexcept override
Getter for member variable NeuronBlock::statement_block.
Definition: all.hpp:14654
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:32144
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:19813
const ArgumentVector & get_parameters() const noexcept override
Getter for member variable FunctionBlock::parameters.
Definition: all.hpp:10790
virtual AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:861
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:6634
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:21536
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:9814
std::string get_nmodl_name() const noexcept override
Return NMODL statement of ast node as std::string.
Definition: all.hpp:21531
bool is_derivimplicit_callback() const noexcept override
Check if the ast node is an instance of ast::DerivimplicitCallback.
Definition: all.hpp:34151
symtab::SymbolTable * get_symbol_table() const override
Return associated symbol table for the current ast node.
Definition: all.hpp:12269
symtab::SymbolTable * get_symbol_table() const override
Return associated symbol table for the current ast node.
Definition: all.hpp:14649
std::shared_ptr< StatementBlock > statement_block
Block with statements vector.
Definition: all.hpp:8271
bool is_else_if_statement() const noexcept override
Check if the ast node is an instance of ast::ElseIfStatement.
Definition: all.hpp:24926
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:15899
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:18462
type of ast::DoubleUnit
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:24215
std::string get_nmodl_name() const noexcept override
Return NMODL statement of ast node as std::string.
Definition: all.hpp:9542
LocalVar * clone() const override
Return a copy of the current node.
Definition: all.hpp:15259
ElectrodeCurVar * clone() const override
Return a copy of the current node.
Definition: all.hpp:4369
Represents a BREAKPOINT block in NMODL.
Definition: all.hpp:11893
BAType get_value() const noexcept
Getter for member variable BABlockType::value.
Definition: all.hpp:19627
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:17763
std::shared_ptr< QueueExpressionType > qtype
queue type (put/get)
Definition: all.hpp:28374
symtab::SymbolTable * get_symbol_table() const override
Return associated symbol table for the current ast node.
Definition: all.hpp:33001
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:22320
type of ast::UnaryOperator
bool is_non_lin_equation() const noexcept override
Check if the ast node is an instance of ast::NonLinEquation.
Definition: all.hpp:17950
virtual const ArgumentVector & get_parameters() const
Definition: all.hpp:511
Match * clone() const override
Return a copy of the current node.
Definition: all.hpp:19339
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:12215
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:26726
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:22060
std::shared_ptr< Expression > condition
TODO.
Definition: all.hpp:24367
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:4162
Represents a block to be executed before or after another block.
Definition: all.hpp:12918
std::shared_ptr< ConstantVar > constant
single constant variable
Definition: all.hpp:28605
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:3289
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:18252
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:4896
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:11059
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:29412
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:31369
void set_symbol_table(symtab::SymbolTable *newsymtab) override
Set symbol table for the current ast node.
Definition: all.hpp:14680
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:30933
const std::shared_ptr< Name > & get_name() const noexcept
Getter for member variable ConstantVar::name.
Definition: all.hpp:16232
ElectrodeCurVarVector currents
Vector of electrode current variables.
Definition: all.hpp:29885
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:22019
std::shared_ptr< Name > name
Variable name.
Definition: all.hpp:5439
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:5731
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:3484
ArgumentVector parameters
Vector of the parameters.
Definition: all.hpp:10967
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:29192
const std::shared_ptr< PlotDeclaration > & get_plot() const noexcept
Getter for member variable PlotBlock::plot.
Definition: all.hpp:7594
std::string value
Value of string.
Definition: all.hpp:986
std::string get_nmodl_name() const noexcept override
Return NMODL statement of ast node as std::string.
Definition: all.hpp:7811
std::shared_ptr< StatementBlock > update_states_block
update back states from X
Definition: all.hpp:33545
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:25711
std::shared_ptr< Name > name
TODO.
Definition: all.hpp:23804
void set_symbol_table(symtab::SymbolTable *newsymtab) override
Set symbol table for the current ast node.
Definition: all.hpp:32782
const std::shared_ptr< StatementBlock > & get_statement_block() const noexcept override
Getter for member variable FunctionBlock::statement_block.
Definition: all.hpp:10802
const ThreadsafeVarVector & get_variables() const noexcept
Getter for member variable ThreadSafe::variables.
Definition: all.hpp:31594
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:28698
const std::shared_ptr< Expression > & get_to() const noexcept
Getter for member variable FromStatement::to.
Definition: all.hpp:23950
std::shared_ptr< StatementBlock > setup_x_block
update X from states
Definition: all.hpp:33140
VarName * clone() const override
Return a copy of the current node.
Definition: all.hpp:2968
Represent CONSERVE statement in NMODL.
Definition: all.hpp:27053
const StatementVector & get_solve_statements() const noexcept
Getter for member variable NrnStateBlock::solve_statements.
Definition: all.hpp:33006
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:4234
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:27693
bool is_double() const noexcept override
Check if the ast node is an instance of ast::Double.
Definition: all.hpp:1739
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:15965
std::shared_ptr< Name > name1
TODO.
Definition: all.hpp:25649
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:24252
const std::shared_ptr< Name > & get_name() const noexcept
Getter for member variable WriteIonVar::name.
Definition: all.hpp:4001
const std::shared_ptr< Name > & get_name() const noexcept
Getter for member variable BbcorePointerVar::name.
Definition: all.hpp:5549
ConductanceHint * clone() const override
Return a copy of the current node.
Definition: all.hpp:23157
std::shared_ptr< Double > value
Value of new timestep.
Definition: all.hpp:34579
BreakpointBlock * clone() const override
Return a copy of the current node.
Definition: all.hpp:11931
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:23415
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:4627
Base class for all expressions in the NMODL.
Definition: all.hpp:346
FirstLastType value
TODO.
Definition: all.hpp:18651
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:14595
const std::shared_ptr< Number > & get_value() const noexcept
Getter for member variable ParamAssign::value.
Definition: all.hpp:21814
void set_symbol_table(symtab::SymbolTable *newsymtab) override
Set symbol table for the current ast node.
Definition: all.hpp:9932
std::string get_nmodl_name() const noexcept override
Return NMODL statement of ast node as std::string.
Definition: all.hpp:12747
const std::shared_ptr< StatementBlock > & get_statement_block() const noexcept override
Getter for member variable DestructorBlock::statement_block.
Definition: all.hpp:8395
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:26918
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:19139
type of ast::ParamBlock
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:20813
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:1090
std::shared_ptr< Unit > unit
Unit for the variable.
Definition: all.hpp:16122
bool is_while_statement() const noexcept override
Check if the ast node is an instance of ast::WhileStatement.
Definition: all.hpp:24392
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:30897
const SectionVarVector & get_sections() const noexcept
Getter for member variable Section::sections.
Definition: all.hpp:30216
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:6200
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:26048
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:18914
bool is_pointer() const noexcept override
Check if the ast node is an instance of ast::Pointer.
Definition: all.hpp:30837
Represents an INCLUDE statement in NMODL.
Definition: all.hpp:21450
std::shared_ptr< StatementBlock > statement_block
Block with statements vector.
Definition: all.hpp:10971
Represent MUTEXLOCK statement in NMODL.
Definition: all.hpp:26271
Represents binary expression in the NMODL.
Definition: all.hpp:17233
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:9919
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:22924
Represents a string.
Definition: all.hpp:983
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:14858
virtual std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:262
const std::shared_ptr< String > & get_value() const noexcept
Getter for member variable Name::value.
Definition: all.hpp:2301
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:25753
TableStatement * clone() const override
Return a copy of the current node.
Definition: all.hpp:28863
bool is_double_unit() const noexcept override
Check if the ast node is an instance of ast::DoubleUnit.
Definition: all.hpp:15025
Wrap any other expression type.
Definition: all.hpp:33915
bool is_extern_var() const noexcept override
Check if the ast node is an instance of ast::ExternVar.
Definition: all.hpp:5682
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:18491
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:29707
std::shared_ptr< Name > name
Name of the macro.
Definition: all.hpp:21204
std::shared_ptr< Identifier > name
TODO.
Definition: all.hpp:15227
const std::shared_ptr< Unit > & get_unit() const noexcept
Getter for member variable IndependentDefinition::unit.
Definition: all.hpp:22355
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:24371
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:19417
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:7486
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:19637
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:18743
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:5884
ReactionOp
enum type used for Reaction statement
Definition: ast_common.hpp:104
std::vector< std::shared_ptr< Statement > > StatementVector
Definition: ast_decl.hpp:336
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:24995
type of ast::ReactVarName
const std::shared_ptr< Double > & get_min() const noexcept
Getter for member variable Limits::min.
Definition: all.hpp:15543
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:14356
double to_double() override
Return value of the current ast node as double.
Definition: all.hpp:1416
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:23922
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:30197
FirstLastType
enum type for partial equation types
Definition: ast_common.hpp:80
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:23444
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:26546
std::string eval() const
Return enum value in string form.
Definition: all.hpp:19705
LinearBlock * clone() const override
Return a copy of the current node.
Definition: all.hpp:9182
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:25657
const std::shared_ptr< Name > & get_steadystate() const noexcept
Getter for member variable SolveBlock::steadystate.
Definition: all.hpp:11714
Represents a C code block.
Definition: all.hpp:31706
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:19369
std::string get_nmodl_name() const noexcept override
Return NMODL statement of ast node as std::string.
Definition: all.hpp:21061
const std::shared_ptr< String > & get_ontology_id() const noexcept
Getter for member variable Useion::ontology_id.
Definition: all.hpp:29506
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:20499
virtual std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:570
EigenLinearSolverBlock * clone() const override
Return a copy of the current node.
Definition: all.hpp:33592
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:3275
std::shared_ptr< Number > from
TODO.
Definition: all.hpp:22211
bool is_global() const noexcept override
Check if the ast node is an instance of ast::Global.
Definition: all.hpp:30565
const std::shared_ptr< String > & get_filename() const noexcept
Getter for member variable Include::filename.
Definition: all.hpp:21562
Operator used in ast::BinaryExpression.
Definition: all.hpp:16371
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:23437
virtual std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:716
std::shared_ptr< Integer > order
order of ODE
Definition: all.hpp:2436
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:33967
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:7823
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:4825
Represent solution of a block in the AST.
Definition: all.hpp:34341
std::shared_ptr< Expression > reaction1
TODO.
Definition: all.hpp:27816
std::vector< std::shared_ptr< ParamAssign > > ParamAssignVector
Definition: ast_decl.hpp:428
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:30632
const std::shared_ptr< Number > & get_value() const noexcept
Getter for member variable ConstantVar::value.
Definition: all.hpp:16237
Represents POINTER statement in NMODL.
Definition: all.hpp:30815
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:17564
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:29722
type of ast::ConstantStatement
const std::shared_ptr< Name > & get_name() const noexcept
Getter for member variable Stepped::name.
Definition: all.hpp:22065
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:15296
const std::shared_ptr< Integer > & get_with() const noexcept
Getter for member variable IndependentDefinition::with.
Definition: all.hpp:22345
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:30646
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:13014
const std::shared_ptr< Expression > & get_expr() const noexcept
Getter for member variable Conserve::expr.
Definition: all.hpp:27174
UnaryOperator * clone() const override
Return a copy of the current node.
Definition: all.hpp:16619
const std::shared_ptr< Double > & get_value() const noexcept
Getter for member variable Valence::value.
Definition: all.hpp:20375
ReactionOperator * clone() const override
Return a copy of the current node.
Definition: all.hpp:16831
std::string get_nmodl_name() const noexcept override
Return NMODL statement of ast node as std::string.
Definition: all.hpp:11658
ReactionOp get_value() const noexcept
Getter for member variable ReactionOperator::value.
Definition: all.hpp:16896
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:10815
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:1786
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:18714
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:32664
const std::shared_ptr< String > & get_name() const noexcept
Getter for member variable Unit::name.
Definition: all.hpp:14890
std::vector< std::shared_ptr< RangeVar > > RangeVarVector
Definition: ast_decl.hpp:357
const std::shared_ptr< Integer > & get_index() const noexcept
Getter for member variable PlotVar::index.
Definition: all.hpp:15996
const std::shared_ptr< String > & get_title() const noexcept
Getter for member variable Model::title.
Definition: all.hpp:21092
bool is_nrn_state_block() const noexcept override
Check if the ast node is an instance of ast::NrnStateBlock.
Definition: all.hpp:32905
type of ast::ConstantBlock
const NameVector & get_depend_vars() const noexcept
Getter for member variable TableStatement::depend_vars.
Definition: all.hpp:28944
ReadIonVarVector readlist
Variables being read.
Definition: all.hpp:29353
std::string get_nmodl_name() const noexcept override
Return NMODL statement of ast node as std::string.
Definition: all.hpp:8351
std::string get_nmodl_name() const noexcept override
Return NMODL statement of ast node as std::string.
Definition: all.hpp:8924
NameVector solvefor
TODO.
Definition: all.hpp:9143
const std::shared_ptr< Integer > & get_length() const noexcept
Getter for member variable AssignedDefinition::length.
Definition: all.hpp:22670
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:6251
const std::shared_ptr< Name > & get_name() const noexcept
Getter for member variable Define::name.
Definition: all.hpp:21326
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:32008
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:26315
virtual std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:563
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:32456
bool is_assigned_definition() const noexcept override
Check if the ast node is an instance of ast::AssignedDefinition.
Definition: all.hpp:22574
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:11360
type of ast::Verbatim
const std::shared_ptr< VarName > & get_name() const noexcept
Getter for member variable ReactVarName::name.
Definition: all.hpp:3550
Define * clone() const override
Return a copy of the current node.
Definition: all.hpp:21239
std::shared_ptr< Block > node_to_solve
Block to be solved (typically derivative)
Definition: all.hpp:34131
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:14786
std::shared_ptr< Name > name
TODO.
Definition: all.hpp:3673
Represents GLOBAL statement in NMODL.
Definition: all.hpp:30543
std::string get_nmodl_name() const noexcept override
Return NMODL statement of ast node as std::string.
Definition: all.hpp:29737
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:11382
IndexedName * clone() const override
Return a copy of the current node.
Definition: all.hpp:2719
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:14615
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:32644
std::vector< T >::iterator const_iter_cast(std::vector< T > &v, typename std::vector< T >::const_iterator iter)
Return non-const iterator corresponding to the const_iterator in a vector.
type of ast::ElseStatement
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:27914
Represents a AFTER block in NMODL.
Definition: after_block.hpp:55
const std::shared_ptr< Identifier > & get_name() const noexcept
Getter for member variable AssignedDefinition::name.
Definition: all.hpp:22665
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:20710
Represents a CONSTRUCTOR block in the NMODL.
Definition: all.hpp:7995
const std::shared_ptr< Number > & get_to() const noexcept
Getter for member variable AssignedDefinition::to.
Definition: all.hpp:22680
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:26104
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:25239
const std::shared_ptr< StatementBlock > & get_statement_block() const noexcept override
Getter for member variable DiscreteBlock::statement_block.
Definition: all.hpp:9906
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:30820
std::shared_ptr< PlotDeclaration > plot
Vector of plot variables.
Definition: all.hpp:7484
const std::shared_ptr< Expression > & get_expression() const noexcept
Getter for member variable ProtectStatement::expression.
Definition: all.hpp:23689
Represent a single variable of type BBCOREPOINTER.
Definition: all.hpp:5436
void set_symbol_table(symtab::SymbolTable *newsymtab) override
Set symbol table for the current ast node.
Definition: all.hpp:12816
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:34195
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:32022
bool is_destructor_block() const noexcept override
Check if the ast node is an instance of ast::DestructorBlock.
Definition: all.hpp:8294
std::shared_ptr< Expression > expression
TODO.
Definition: all.hpp:27298
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:15763
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:34426
bool is_number_range() const noexcept override
Check if the ast node is an instance of ast::NumberRange.
Definition: all.hpp:15693
std::vector< std::shared_ptr< Node > > NodeVector
Definition: ast_decl.hpp:335
const std::shared_ptr< Unit > & get_unit1() const noexcept
Getter for member variable UnitDef::unit1.
Definition: all.hpp:19852
Represents a INITIAL block in the NMODL.
Definition: all.hpp:7729
Include * clone() const override
Return a copy of the current node.
Definition: all.hpp:21488
virtual AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:548
const std::shared_ptr< Expression > & get_expression() const noexcept
Getter for member variable ParenExpression::expression.
Definition: all.hpp:17107
std::string get_nmodl_name() const noexcept override
Return NMODL statement of ast node as std::string.
Definition: all.hpp:14083
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:22305
type of ast::LinearBlock
Represents a one line comment in NMODL.
Definition: all.hpp:31929
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:28439
symtab::SymbolTable * get_symbol_table() const override
Return associated symbol table for the current ast node.
Definition: all.hpp:7850
std::shared_ptr< String > statement
C code as a string.
Definition: all.hpp:31709
type of ast::StateBlock
std::shared_ptr< Unit > unit
TODO.
Definition: all.hpp:15004
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:6207
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:28446
void negate() override
Negate the value of current ast node.
Definition: all.hpp:2131
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:20798
std::shared_ptr< Name > name
Name of the derivative block.
Definition: all.hpp:8841
std::shared_ptr< Expression > react
TODO.
Definition: all.hpp:27056
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:25454
const std::shared_ptr< Unit > & get_unit() const noexcept
Getter for member variable Argument::unit.
Definition: all.hpp:3312
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:15558
const VarNameVector & get_variables() const noexcept
Getter for member variable Sens::variables.
Definition: all.hpp:26944
const std::shared_ptr< StatementBlock > & get_update_states_block() const noexcept
Getter for member variable EigenNewtonSolverBlock::update_states_block.
Definition: all.hpp:33325
const RangeVarVector & get_variables() const noexcept
Getter for member variable Range::variables.
Definition: all.hpp:30433
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:12287
bool is_limits() const noexcept override
Check if the ast node is an instance of ast::Limits.
Definition: all.hpp:15470
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:2998
const std::shared_ptr< StatementBlock > & get_update_states_block() const noexcept
Getter for member variable EigenLinearSolverBlock::update_states_block.
Definition: all.hpp:33717
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:26925
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:17102
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:27561
const std::shared_ptr< Name > & get_name() const noexcept
Getter for member variable KineticBlock::name.
Definition: all.hpp:13597
const std::shared_ptr< StatementBlock > & get_statement_block() const noexcept override
Getter for member variable ElseStatement::statement_block.
Definition: all.hpp:25258
Boolean * clone() const override
Return a copy of the current node.
Definition: all.hpp:1986
symtab::ModelSymbolTable * get_model_symbol_table()
Return global symbol table for the mod file.
Definition: all.hpp:32703
std::shared_ptr< Unit > unit
TODO.
Definition: all.hpp:22544
bool is_reset() const noexcept override
Check if the ast node is an instance of ast::Reset.
Definition: all.hpp:26666
const std::shared_ptr< Name > & get_name1() const noexcept
Getter for member variable PartialEquation::name1.
Definition: all.hpp:25485
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:5000
const std::shared_ptr< Integer > & get_value() const noexcept
Getter for member variable ReactVarName::value.
Definition: all.hpp:3532
std::shared_ptr< Name > name
TODO.
Definition: all.hpp:22209
bool is_block() const noexcept override
Check if the ast node is an instance of ast::Block.
Definition: all.hpp:521
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:13181
const std::shared_ptr< Integer > & get_n_state_vars() const noexcept
Getter for member variable EigenLinearSolverBlock::n_state_vars.
Definition: all.hpp:33686
Represent statement in CONSTANT block of NMODL.
Definition: all.hpp:28602
std::shared_ptr< Double > max
TODO.
Definition: all.hpp:15449
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:31147
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:30211
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:9622
type of ast::NonLinearBlock
const std::shared_ptr< Expression > & get_condition() const noexcept
Getter for member variable IfStatement::condition.
Definition: all.hpp:24733
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:8321
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:5944
std::shared_ptr< Name > name
TODO.
Definition: all.hpp:4778
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:15081
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:9253
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:1219
void set_symbol_table(symtab::SymbolTable *newsymtab) override
Set symbol table for the current ast node.
Definition: all.hpp:8727
bool is_partial_boundary() const noexcept override
Check if the ast node is an instance of ast::PartialBoundary.
Definition: all.hpp:25684
Represents top level AST node for whole NMODL input.
Definition: all.hpp:32589
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:1807
bool is_queue_statement() const noexcept override
Check if the ast node is an instance of ast::QueueStatement.
Definition: all.hpp:28397
AssignedDefinition * clone() const override
Return a copy of the current node.
Definition: all.hpp:22586
NonLinearBlock * clone() const override
Return a copy of the current node.
Definition: all.hpp:9497
OntologyStatement * clone() const override
Return a copy of the current node.
Definition: all.hpp:32397
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:22603
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:5280
symtab::SymbolTable * get_symbol_table() const override
Return associated symbol table for the current ast node.
Definition: all.hpp:33282
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:21763
IfStatement * clone() const override
Return a copy of the current node.
Definition: all.hpp:24657
std::shared_ptr< StatementBlock > statement_block
Block with statements vector.
Definition: all.hpp:8843
FunctionCall * clone() const override
Return a copy of the current node.
Definition: all.hpp:18447
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:23881
std::shared_ptr< StatementBlock > statement_block
Block with statements vector.
Definition: all.hpp:13179
std::shared_ptr< Expression > from
TODO.
Definition: all.hpp:23806
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:21341
const std::shared_ptr< Expression > & get_reaction2() const noexcept
Getter for member variable ReactionStatement::reaction2.
Definition: all.hpp:27953
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:11080
bool is_name() const noexcept override
Check if the ast node is an instance of ast::Name.
Definition: all.hpp:2215
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:10134
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:34419
Represents a STEPPED block in the NMODL.
Definition: all.hpp:6374
const std::shared_ptr< Name > & get_ion() const noexcept
Getter for member variable ConductanceHint::ion.
Definition: all.hpp:23242
std::string get_nmodl_name() const noexcept override
Return NMODL statement of ast node as std::string.
Definition: all.hpp:30892
String * clone() const override
Return a copy of the current node.
Definition: all.hpp:1019
Valence * clone() const override
Return a copy of the current node.
Definition: all.hpp:20309
Pointer * clone() const override
Return a copy of the current node.
Definition: all.hpp:30849
std::shared_ptr< Expression > to
TODO.
Definition: all.hpp:23808
bool is_global_var() const noexcept override
Check if the ast node is an instance of ast::GlobalVar.
Definition: all.hpp:5018
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:15451
std::shared_ptr< Expression > expression
TODO.
Definition: all.hpp:25647
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:20601
const std::shared_ptr< Boolean > & get_gt() const noexcept
Getter for member variable FactorDef::gt.
Definition: all.hpp:20117
PlotVarVector variables
TODO.
Definition: all.hpp:22874
void set_symbol_table(symtab::SymbolTable *newsymtab) override
Set symbol table for the current ast node.
Definition: all.hpp:33359
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:27391
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:24475
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:17292
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:26504
ConstantBlock * clone() const override
Return a copy of the current node.
Definition: all.hpp:14299
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:31355
std::shared_ptr< Number > from
TODO.
Definition: all.hpp:22538
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:16863
symtab::SymbolTable * get_symbol_table() const override
Return associated symbol table for the current ast node.
Definition: all.hpp:13875
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:22034
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:4605
std::string get_nmodl_name() const noexcept override
Return NMODL statement of ast node as std::string.
Definition: all.hpp:13260
std::shared_ptr< StatementBlock > functor_block
odes as functor for eigen
Definition: all.hpp:33142
NameVector table_vars
Variables in the table.
Definition: all.hpp:28818
ReadIonVar * clone() const override
Return a copy of the current node.
Definition: all.hpp:3705
std::shared_ptr< Name > name
TODO.
Definition: all.hpp:27296
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:21033
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:15720
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:7606
type of ast::Nonspecific
AssignedDefinitionVector definitions
Vector of state variables.
Definition: all.hpp:7226
const std::shared_ptr< Name > & get_name() const noexcept
Getter for member variable NonspecificCurVar::name.
Definition: all.hpp:4224
LinEquation * clone() const override
Return a copy of the current node.
Definition: all.hpp:18202
BinaryExpression * clone() const override
Return a copy of the current node.
Definition: all.hpp:17275
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:17992
bool is_binary_operator() const noexcept override
Check if the ast node is an instance of ast::BinaryOperator.
Definition: all.hpp:16395
std::string get_nmodl_name() const noexcept override
Return NMODL statement of ast node as std::string.
Definition: all.hpp:11054
std::shared_ptr< Integer > at
Value specified with @
Definition: all.hpp:2932
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:16465
const std::shared_ptr< Name > & get_name() const noexcept
Getter for member variable ReadIonVar::name.
Definition: all.hpp:3781
LocalVarVector::const_iterator insert_local_var(LocalVarVector::const_iterator position, const std::shared_ptr< LocalVar > &n)
Insert member to variables.
Definition: ast.cpp:7847
std::string value
Value of float.
Definition: all.hpp:1473
const std::shared_ptr< Name > & get_name3() const noexcept
Getter for member variable PartialEquation::name3.
Definition: all.hpp:25495
virtual Identifier * clone() const override
Return a copy of the current node.
Definition: all.hpp:686
ArgumentVector parameters
Vector of the parameters.
Definition: all.hpp:10641
symtab::SymbolTable * get_symbol_table() const override
Return associated symbol table for the current ast node.
Definition: all.hpp:8121
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:11024
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:2257
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:8610
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:8108
FunctionTableBlock * clone() const override
Return a copy of the current node.
Definition: all.hpp:10372
type of ast::BeforeBlock
const std::shared_ptr< Identifier > & get_name() const noexcept
Getter for member variable LagStatement::name.
Definition: all.hpp:28246
WatchVector statements
Vector of watch statements.
Definition: all.hpp:26002
symtab::SymbolTable * get_symbol_table() const override
Return associated symbol table for the current ast node.
Definition: all.hpp:6234
Represent CONSTANT block in the mod file.
Definition: all.hpp:14263
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:18653
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:7548
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:2269
std::vector< std::shared_ptr< Number > > NumberVector
Definition: ast_decl.hpp:340
bool is_useion() const noexcept override
Check if the ast node is an instance of ast::Useion.
Definition: all.hpp:29385
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:5559
Represents a ASSIGNED block in the NMODL.
Definition: all.hpp:6899
const std::shared_ptr< Name > & get_conductance() const noexcept
Getter for member variable ConductanceHint::conductance.
Definition: all.hpp:23235
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:10404
Represents RANGE variables statement in NMODL.
Definition: all.hpp:30325
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:24208
const std::shared_ptr< Name > & get_block_name() const noexcept
Getter for member variable SolveBlock::block_name.
Definition: all.hpp:11702
symtab::SymbolTable * get_symbol_table() const override
Return associated symbol table for the current ast node.
Definition: all.hpp:12786
const std::shared_ptr< Unit > & get_unit() const noexcept
Getter for member variable DoubleUnit::unit.
Definition: all.hpp:15105
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:25461
BABlock * clone() const override
Return a copy of the current node.
Definition: all.hpp:12958
type of ast::PartialBoundary
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:22959
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:32449
bool is_kinetic_block() const noexcept override
Check if the ast node is an instance of ast::KineticBlock.
Definition: all.hpp:13483
virtual std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:890
const GlobalVarVector & get_variables() const noexcept
Getter for member variable Global::variables.
Definition: all.hpp:30706
std::shared_ptr< String > statement
comment text
Definition: all.hpp:31932
type of ast::ProtectStatement
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:28424
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:9554
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:33210
type of ast::External
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:1546
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:9870
bool is_identifier() const noexcept override
Check if the ast node is an instance of ast::Identifier.
Definition: all.hpp:674
Represents a BEFORE block in NMODL.
Definition: all.hpp:12401
std::string get_nmodl_name() const noexcept override
Return NMODL statement of ast node as std::string.
Definition: all.hpp:23202
Represent symbol table for a NMODL block.
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:34180
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:12235
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:27060
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:6119
std::shared_ptr< StatementBlock > variable_block
Statements to be declared in the functor.
Definition: all.hpp:33539
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:19747
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:19381
const std::shared_ptr< Expression > & get_expression() const noexcept
Getter for member variable UnaryExpression::expression.
Definition: all.hpp:17801
encapsulates everything related to NMODL code generation framework
Definition: ast_common.hpp:26
const std::shared_ptr< Integer > & get_n_state_vars() const noexcept
Getter for member variable EigenNewtonSolverBlock::n_state_vars.
Definition: all.hpp:33287
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:29427
const std::shared_ptr< Name > & get_name() const noexcept
Getter for member variable FunctionCall::name.
Definition: all.hpp:18523
type of ast::MatchBlock
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:14533
ThreadsafeVarVector variables
Vector of thread safe variables.
Definition: all.hpp:31487
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:4339
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:24461
std::shared_ptr< Expression > condition
TODO.
Definition: all.hpp:24901
bool is_initial_block() const noexcept override
Check if the ast node is an instance of ast::InitialBlock.
Definition: all.hpp:7754
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:3560
std::shared_ptr< Name > name
Name of the channel.
Definition: all.hpp:29117
std::string get_nmodl_name() const noexcept override
Return NMODL statement of ast node as std::string.
Definition: all.hpp:26913
std::shared_ptr< PrimeName > prime
TODO.
Definition: all.hpp:25375
const UnaryOperator & get_op() const noexcept
Getter for member variable UnaryExpression::op.
Definition: all.hpp:17796
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:28489
std::vector< std::shared_ptr< ElseIfStatement > > ElseIfStatementVector
Definition: ast_decl.hpp:443
const std::shared_ptr< Name > & get_name() const noexcept
Getter for member variable NonLinearBlock::name.
Definition: all.hpp:9599
std::shared_ptr< Name > name
TODO.
Definition: all.hpp:3893
std::shared_ptr< Expression > expression
TODO.
Definition: all.hpp:23579
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:21048
ElseStatement * clone() const override
Return a copy of the current node.
Definition: all.hpp:25182
std::shared_ptr< Name > name
TODO.
Definition: all.hpp:4337
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:29782
bool is_independent_definition() const noexcept override
Check if the ast node is an instance of ast::IndependentDefinition.
Definition: all.hpp:22247
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:12803
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:2028
IndependentBlock * clone() const override
Return a copy of the current node.
Definition: all.hpp:6665
const IndependentDefinitionVector & get_definitions() const noexcept
Getter for member variable IndependentBlock::definitions.
Definition: all.hpp:6758
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:32189
virtual std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:402
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:24968
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:31348
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:4620
void set_symbol_table(symtab::SymbolTable *newsymtab) override
Set symbol table for the current ast node.
Definition: all.hpp:10828
void set_symbol_table(symtab::SymbolTable *newsymtab) override
Set symbol table for the current ast node.
Definition: all.hpp:13339
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:1034
const std::shared_ptr< StatementBlock > & get_statement_block() const noexcept override
Getter for member variable ForNetcon::statement_block.
Definition: all.hpp:13313
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:33996
std::shared_ptr< Boolean > sweep
TODO.
Definition: all.hpp:22207
std::shared_ptr< Name > name
Name of the procedure.
Definition: all.hpp:10965
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:31384
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:28676
std::vector< std::shared_ptr< Name > > NameVector
Definition: ast_decl.hpp:346
IndependentDefinition * clone() const override
Return a copy of the current node.
Definition: all.hpp:22259
std::shared_ptr< Name > block_name
Name of the block to solve.
Definition: all.hpp:11569
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:26171
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:34241
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:3735
std::string get_nmodl_name() const noexcept override
Return NMODL statement of ast node as std::string.
Definition: all.hpp:27909
Watch * clone() const override
Return a copy of the current node.
Definition: all.hpp:18899
BinaryOperator * clone() const override
Return a copy of the current node.
Definition: all.hpp:16407
double to_double() override
Return value of the current ast node as double.
Definition: all.hpp:2136
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:24714
void set_symbol_table(symtab::SymbolTable *newsymtab) override
Set symbol table for the current ast node.
Definition: all.hpp:7619
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:17578
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:33668
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:17550
Represents DERIVATIVE block in the NMODL.
Definition: all.hpp:8838
std::shared_ptr< StatementBlock > update_states_block
update back states from X
Definition: all.hpp:33144
UnitStateType value
TODO.
Definition: all.hpp:20497
ProtectStatement * clone() const override
Return a copy of the current node.
Definition: all.hpp:23611
std::string get_nmodl_name() const noexcept override
Return NMODL statement of ast node as std::string.
Definition: all.hpp:23896
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:1075
std::string get_nmodl_name() const noexcept override
Return NMODL statement of ast node as std::string.
Definition: all.hpp:29440
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:12495
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:20084
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:22221
std::shared_ptr< StatementBlock > statement_block
Block with statements vector.
Definition: all.hpp:11293
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:3940
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:11403
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:30157
virtual AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:233
std::shared_ptr< Expression > expression
TODO.
Definition: all.hpp:23366
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:3527
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:4868
FactorDef * clone() const override
Return a copy of the current node.
Definition: all.hpp:20026
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:32231
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:28378
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:3720
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:2983
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:23901
std::shared_ptr< Unit > unit1
TODO.
Definition: all.hpp:19743
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:27148
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:22878
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:31489
bool is_threadsafe_var() const noexcept override
Check if the ast node is an instance of ast::ThreadsafeVar.
Definition: all.hpp:5902
std::string get_nmodl_name() const noexcept override
Return NMODL statement of ast node as std::string.
Definition: all.hpp:32219
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:31568
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:33247
virtual std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:255
std::shared_ptr< Expression > expr
TODO.
Definition: all.hpp:27058
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:32429
std::string get_nmodl_name() const noexcept override
Return NMODL statement of ast node as std::string.
Definition: all.hpp:28908
type of ast::NeuronBlock
const ExpressionVector & get_arguments() const noexcept
Getter for member variable FunctionCall::arguments.
Definition: all.hpp:18528
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:31089
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:2763
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:15517
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:20070
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:32594
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:23430
void set_symbol_table(symtab::SymbolTable *newsymtab) override
Set symbol table for the current ast node.
Definition: all.hpp:9320
std::shared_ptr< Identifier > name
Name of array variable.
Definition: all.hpp:2684
WhileStatement * clone() const override
Return a copy of the current node.
Definition: all.hpp:24404
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:31313
Represents an argument to functions and procedures.
Definition: all.hpp:3193
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:29452
type of ast::InitialBlock
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:8065
symtab::SymbolTable * get_symbol_table() const override
Return associated symbol table for the current ast node.
Definition: all.hpp:7589
Useion * clone() const override
Return a copy of the current node.
Definition: all.hpp:29397
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:26004
ReactionOperator op
TODO.
Definition: all.hpp:27818
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:8950
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:9547
std::vector< std::shared_ptr< Argument > > ArgumentVector
Definition: ast_decl.hpp:350
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:7796
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:11441
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:30592
const std::shared_ptr< Name > & get_name() const noexcept
Getter for member variable ForAllStatement::name.
Definition: all.hpp:24234
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:16692
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:16193
std::vector< std::shared_ptr< LocalVar > > LocalVarVector
Definition: ast_decl.hpp:397
ArgumentVector parameters
Arguments to the for netcon block.
Definition: all.hpp:13177
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:16877
void set_symbol_table(symtab::SymbolTable *newsymtab) override
Set symbol table for the current ast node.
Definition: all.hpp:14152
bool is_stepped() const noexcept override
Check if the ast node is an instance of ast::Stepped.
Definition: all.hpp:21992
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:13460
std::vector< std::shared_ptr< GlobalVar > > GlobalVarVector
Definition: ast_decl.hpp:358
const NumberVector & get_values() const noexcept
Getter for member variable Stepped::values.
Definition: all.hpp:22070
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:4384
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:7228
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:10099
const std::shared_ptr< Name > & get_name() const noexcept
Getter for member variable LonDifuse::name.
Definition: all.hpp:27671
bool is_electrode_cur_var() const noexcept override
Check if the ast node is an instance of ast::ElectrodeCurVar.
Definition: all.hpp:4357
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:27826
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:17307
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:7734
std::string value
Value of double.
Definition: all.hpp:1718
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:16848
ExternVarVector variables
Vector of external variables.
Definition: all.hpp:31267
std::string get_nmodl_name() const noexcept override
Return NMODL statement of ast node as std::string.
Definition: all.hpp:27638
type of ast::FromStatement
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:32204
bool is_linear_block() const noexcept override
Check if the ast node is an instance of ast::LinearBlock.
Definition: all.hpp:9170
const std::shared_ptr< StatementBlock > & get_statement_block() const noexcept override
Getter for member variable InitialBlock::statement_block.
Definition: all.hpp:7855
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:23908
std::shared_ptr< Identifier > name
Name of the argument.
Definition: all.hpp:3196
QueueType
enum type for queue types
Definition: ast_common.hpp:86
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:22291
type of ast::NonspecificCurVar
const std::shared_ptr< Expression > & get_react() const noexcept
Getter for member variable Conserve::react.
Definition: all.hpp:27167
std::shared_ptr< Expression > expression
TODO.
Definition: all.hpp:17012
type of ast::FunctionBlock
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:5067
bool is_procedure_block() const noexcept override
Check if the ast node is an instance of ast::ProcedureBlock.
Definition: all.hpp:10997
void set_symbol_table(symtab::SymbolTable *newsymtab) override
Set symbol table for the current ast node.
Definition: all.hpp:11454
const std::string & get_value() const noexcept
Getter for member variable String::value.
Definition: all.hpp:1080
const WatchVector & get_statements() const noexcept
Getter for member variable WatchStatement::statements.
Definition: all.hpp:26161
std::shared_ptr< Number > start
TODO.
Definition: all.hpp:22217
MatchBlock * clone() const override
Return a copy of the current node.
Definition: all.hpp:13791
const std::shared_ptr< Unit > & get_unit2() const noexcept
Getter for member variable UnitDef::unit2.
Definition: all.hpp:19857
WriteIonVarVector writelist
Variables being written.
Definition: all.hpp:29355
const std::shared_ptr< FirstLastTypeIndex > & get_index() const noexcept
Getter for member variable PartialBoundary::index.
Definition: all.hpp:25782
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:21102
std::vector< std::shared_ptr< Match > > MatchVector
Definition: ast_decl.hpp:417
const std::shared_ptr< StatementBlock > & get_statement_block() const noexcept override
Getter for member variable ProcedureBlock::statement_block.
Definition: all.hpp:11128
PlotVar * clone() const override
Return a copy of the current node.
Definition: all.hpp:15930
std::string get_nmodl_name() const noexcept override
Return NMODL statement of ast node as std::string.
Definition: all.hpp:10728
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:21457
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:3742
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:15006
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:12732
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:3513
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:25151
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:2486
FirstLastType get_value() const noexcept
Getter for member variable FirstLastTypeIndex::value.
Definition: all.hpp:18748
std::shared_ptr< Unit > unit2
TODO.
Definition: all.hpp:19745
NodeVector::const_iterator insert_node(NodeVector::const_iterator position, const std::shared_ptr< Node > &n)
Insert member to blocks.
Definition: ast.cpp:13573
LineComment * clone() const override
Return a copy of the current node.
Definition: all.hpp:31964
VarNameVector variables
TODO.
Definition: all.hpp:26839
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:2529
bool is_electrode_current() const noexcept override
Check if the ast node is an instance of ast::ElectrodeCurrent.
Definition: all.hpp:29904
Represents a float variable.
Definition: all.hpp:1470
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:29991
ParamAssignVector statements
Vector of parameters.
Definition: all.hpp:6117
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:30443
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:18259
std::string get_nmodl_name() const noexcept override
Return NMODL statement of ast node as std::string.
Definition: all.hpp:26534
std::shared_ptr< Name > name
TODO.
Definition: all.hpp:5882
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:22632
bool is_nonspecific_cur_var() const noexcept override
Check if the ast node is an instance of ast::NonspecificCurVar.
Definition: all.hpp:4133
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:2262
std::string get_nmodl_name() const noexcept override
Return NMODL statement of ast node as std::string.
Definition: all.hpp:26345
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:30548
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:15497
Verbatim * clone() const override
Return a copy of the current node.
Definition: all.hpp:31741
symtab::SymbolTable * get_symbol_table() const override
Return associated symbol table for the current ast node.
Definition: all.hpp:14383
type of ast::Conserve
const std::shared_ptr< Number > & get_from() const noexcept
Getter for member variable IndependentDefinition::from.
Definition: all.hpp:22335
FirstLastTypeIndex * clone() const override
Return a copy of the current node.
Definition: all.hpp:18682
const std::shared_ptr< Name > & get_name2() const noexcept
Getter for member variable PartialEquation::name2.
Definition: all.hpp:25490
bool is_section() const noexcept override
Check if the ast node is an instance of ast::Section.
Definition: all.hpp:30130
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:30864
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:33254
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:14139
std::shared_ptr< Name > name
TODO.
Definition: all.hpp:5218
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:1054
Represent linear solver solution block based on Eigen.
Definition: all.hpp:33534
bool is_verbatim() const noexcept override
Check if the ast node is an instance of ast::Verbatim.
Definition: all.hpp:31729
RangeVarVector variables
Vector of range variables.
Definition: all.hpp:30328
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:28683
LocalVarVector variables
TODO.
Definition: all.hpp:20708
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:4847
std::shared_ptr< Number > min
TODO.
Definition: all.hpp:15670
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:14268
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:17535
std::vector< std::shared_ptr< VarName > > VarNameVector
Definition: ast_decl.hpp:349
std::shared_ptr< PlotVar > name
TODO.
Definition: all.hpp:22876
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:28828
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:18979
const LocalVarVector & get_variables() const noexcept
Getter for member variable LocalListStatement::variables.
Definition: all.hpp:20873
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:26381
const std::shared_ptr< Name > & get_name() const noexcept
Getter for member variable FunctionTableBlock::name.
Definition: all.hpp:10479
std::shared_ptr< Identifier > name
Name of variable.
Definition: all.hpp:2930
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:21834
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:14580
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:9856
const std::shared_ptr< Unit > & get_unit1() const noexcept
Getter for member variable FactorDef::unit1.
Definition: all.hpp:20112
bool is_constructor_block() const noexcept override
Check if the ast node is an instance of ast::ConstructorBlock.
Definition: all.hpp:8021
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:23172
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:21294
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:18699
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:27645
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:18758
Global * clone() const override
Return a copy of the current node.
Definition: all.hpp:30577
std::shared_ptr< Expression > lhs
LHS of the binary expression.
Definition: all.hpp:17236
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:23459
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:21087
const PointerVarVector & get_variables() const noexcept
Getter for member variable Pointer::variables.
Definition: all.hpp:30923
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:31548
bool is_if_statement() const noexcept override
Check if the ast node is an instance of ast::IfStatement.
Definition: all.hpp:24645
std::string get_nmodl_name() const noexcept override
Return NMODL statement of ast node as std::string.
Definition: all.hpp:25227
const std::shared_ptr< Expression > & get_to() const noexcept
Getter for member variable TableStatement::to.
Definition: all.hpp:28954
std::vector< std::shared_ptr< ReadIonVar > > ReadIonVarVector
Definition: ast_decl.hpp:352
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:6770
std::string get_nmodl_name() const noexcept override
Return NMODL statement of ast node as std::string.
Definition: all.hpp:20786
type of ast::MutexUnlock
std::shared_ptr< Expression > value
TODO.
Definition: all.hpp:18866
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:4177
int value
Value of integer.
Definition: all.hpp:1215
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:5045
void set_symbol_table(symtab::SymbolTable *newsymtab) override
Set symbol table for the current ast node.
Definition: all.hpp:7110
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:17770
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:16124
Represents an integer variable.
Definition: all.hpp:1212
symtab::SymbolTable * get_symbol_table() const override
Return associated symbol table for the current ast node.
Definition: all.hpp:11416
bool is_function_block() const noexcept override
Check if the ast node is an instance of ast::FunctionBlock.
Definition: all.hpp:10671
type of ast::IndexedName
std::shared_ptr< StatementBlock > statement_block
Block with statements vector.
Definition: all.hpp:13458
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:31045
ExpressionVector definitions
Vector of unit statements.
Definition: all.hpp:14005
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:33982
BinaryOp get_value() const noexcept
Getter for member variable BinaryOperator::value.
Definition: all.hpp:16470
const std::shared_ptr< Expression > & get_left_linxpression() const noexcept
Getter for member variable LinEquation::left_linxpression.
Definition: all.hpp:18278
std::vector< std::shared_ptr< PlotVar > > PlotVarVector
Definition: ast_decl.hpp:400
std::string get_nmodl_name() const noexcept override
Return NMODL statement of ast node as std::string.
Definition: all.hpp:29963
std::shared_ptr< Identifier > name
Name of the variable (TODO)
Definition: all.hpp:28135
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:29518
PlotBlock * clone() const override
Return a copy of the current node.
Definition: all.hpp:7518
const NodeVector & get_blocks() const noexcept
Getter for member variable Include::blocks.
Definition: all.hpp:21569
Represents a DESTRUCTOR block in the NMODL.
Definition: all.hpp:8268
const std::shared_ptr< Name > & get_name() const noexcept
Getter for member variable FromStatement::name.
Definition: all.hpp:23940
ParamAssign * clone() const override
Return a copy of the current node.
Definition: all.hpp:21733
const ElectrodeCurVarVector & get_currents() const noexcept
Getter for member variable ElectrodeCurrent::currents.
Definition: all.hpp:29996
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:8714
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:5308
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:15512
const std::shared_ptr< Name > & get_name1() const noexcept
Getter for member variable PartialBoundary::name1.
Definition: all.hpp:25796
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:26747
Represent SENS statement in NMODL.
Definition: all.hpp:26836
symtab::SymbolTable * get_symbol_table() const override
Return associated symbol table for the current ast node.
Definition: all.hpp:11093
const std::shared_ptr< BABlock > & get_bablock() const noexcept
Getter for member variable AfterBlock::bablock.
Definition: all.hpp:12791
const std::shared_ptr< String > & get_value() const noexcept
Getter for member variable PrimeName::value.
Definition: all.hpp:2547
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:8273
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:3969
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:20756
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:19154
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:15067
type of ast::BbcorePointerVar
std::string get_nmodl_name() const noexcept override
Return NMODL statement of ast node as std::string.
Definition: all.hpp:11976
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:9239
virtual Statement * clone() const override
Return a copy of the current node.
Definition: all.hpp:218
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:22625
const std::shared_ptr< StatementBlock > & get_statement_block() const noexcept override
Getter for member variable PartialBlock::statement_block.
Definition: all.hpp:10191
std::shared_ptr< String > ontology_id
Ontology name.
Definition: all.hpp:32365
bool is_statement() const noexcept override
Check if the ast node is an instance of ast::Statement.
Definition: all.hpp:206
bool is_wrapped_expression() const noexcept override
Check if the ast node is an instance of ast::WrappedExpression.
Definition: all.hpp:33938
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:26539
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:21308
bool is_nonspecific() const noexcept override
Check if the ast node is an instance of ast::Nonspecific.
Definition: all.hpp:29680
bool is_constant_var() const noexcept override
Check if the ast node is an instance of ast::ConstantVar.
Definition: all.hpp:16144
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:31133
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:20565
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:23643
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:15317
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:26083
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:8139
std::shared_ptr< Unit > unit
Unit of the argument.
Definition: all.hpp:3198
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:22647
const std::shared_ptr< QueueExpressionType > & get_qtype() const noexcept
Getter for member variable QueueStatement::qtype.
Definition: all.hpp:28472
std::shared_ptr< StatementBlock > statement_block
TODO.
Definition: all.hpp:24369
bool is_function_call() const noexcept override
Check if the ast node is an instance of ast::FunctionCall.
Definition: all.hpp:18435
std::shared_ptr< Expression > expression2
TODO.
Definition: all.hpp:27824
UnitState * clone() const override
Return a copy of the current node.
Definition: all.hpp:20528
ConstantStatement * clone() const override
Return a copy of the current node.
Definition: all.hpp:28637
std::shared_ptr< Expression > expression
TODO.
Definition: all.hpp:18864
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:19601
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:10733
const std::shared_ptr< Integer > & get_value() const noexcept
Getter for member variable Define::value.
Definition: all.hpp:21331
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:11345
const BbcorePointerVarVector & get_variables() const noexcept
Getter for member variable BbcorePointer::variables.
Definition: all.hpp:31152
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:28220
virtual std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:577
bool is_discrete_block() const noexcept override
Check if the ast node is an instance of ast::DiscreteBlock.
Definition: all.hpp:9787
bool is_bbcore_pointer() const noexcept override
Check if the ast node is an instance of ast::BbcorePointer.
Definition: all.hpp:31062
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:20132
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:32659
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:6165
bool is_section_var() const noexcept override
Check if the ast node is an instance of ast::SectionVar.
Definition: all.hpp:4578
UnaryOperator op
TODO.
Definition: all.hpp:17698
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:14349
Type to represent different block types for before/after block.
Definition: all.hpp:19530
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:12256
NeuronBlock * clone() const override
Return a copy of the current node.
Definition: all.hpp:14565
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:23628
std::vector< std::shared_ptr< BbcorePointerVar > > BbcorePointerVarVector
Definition: ast_decl.hpp:360
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:34224
bool is_model() const noexcept override
Check if the ast node is an instance of ast::Model.
Definition: all.hpp:21006
std::string get_nmodl_name() const noexcept override
Return NMODL statement of ast node as std::string.
Definition: all.hpp:32962
std::shared_ptr< Identifier > name
TODO.
Definition: all.hpp:15895
type of ast::Expression
const std::shared_ptr< String > & get_statement() const noexcept
Getter for member variable Verbatim::statement.
Definition: all.hpp:31817
std::shared_ptr< Integer > length
Length in case of array.
Definition: all.hpp:22536
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:1475
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:3261
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:2001
const std::shared_ptr< Name > & get_name() const noexcept
Getter for member variable Useion::name.
Definition: all.hpp:29484
Sens * clone() const override
Return a copy of the current node.
Definition: all.hpp:26870
std::string get_nmodl_name() const noexcept override
Return NMODL statement of ast node as std::string.
Definition: all.hpp:12230
std::shared_ptr< StatementBlock > finalize_block
Statement block to be executed after calling linear solver.
Definition: all.hpp:33547
const std::shared_ptr< Name > & get_name() const noexcept
Getter for member variable PointerVar::name.
Definition: all.hpp:5326
const std::shared_ptr< Double > & get_max() const noexcept
Getter for member variable Limits::max.
Definition: all.hpp:15548
Represents the coreneuron nrn_state callback function.
Definition: all.hpp:32881
const std::shared_ptr< StatementBlock > & get_statement_block() const noexcept override
Getter for member variable ForAllStatement::statement_block.
Definition: all.hpp:24239
virtual std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:730
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:30330
std::shared_ptr< String > filename
path to the file to include
Definition: all.hpp:21453
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:19395
const std::shared_ptr< Identifier > & get_name() const noexcept
Getter for member variable VarName::name.
Definition: all.hpp:3042
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:23581
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:32001
bool is_range() const noexcept override
Check if the ast node is an instance of ast::Range.
Definition: all.hpp:30347
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:17557
Represents a name.
Definition: all.hpp:2190
Represents a prime variable (for ODE)
Definition: all.hpp:2431
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:24765
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:18934
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:26063
AfterBlock * clone() const override
Return a copy of the current node.
Definition: all.hpp:12702
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:31979
std::string get_nmodl_name() const noexcept override
Return NMODL statement of ast node as std::string.
Definition: all.hpp:13836
MutexUnlock * clone() const override
Return a copy of the current node.
Definition: all.hpp:26489
NameVector solvefor
Name of the integration method.
Definition: all.hpp:9458
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:24953
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:12152
BinaryOperator op
Operator.
Definition: all.hpp:17238
std::shared_ptr< Expression > expression1
TODO.
Definition: all.hpp:27822
type of ast::ProcedureBlock
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:31771
symtab::SymbolTable * get_symbol_table() const override
Return associated symbol table for the current ast node.
Definition: all.hpp:7019
Represents BBCOREPOINTER statement in NMODL.
Definition: all.hpp:31040
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:11577
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:11628
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:20351
type of ast::NumberRange
type of ast::BbcorePointer
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:23368
const std::shared_ptr< Expression > & get_index() const noexcept
Getter for member variable VarName::index.
Definition: all.hpp:3052
bool is_define() const noexcept override
Check if the ast node is an instance of ast::Define.
Definition: all.hpp:21227
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:20883
std::shared_ptr< String > title
TODO.
Definition: all.hpp:20986
bool is_compartment() const noexcept override
Check if the ast node is an instance of ast::Compartment.
Definition: all.hpp:27322
std::shared_ptr< StatementBlock > statement_block
Block with statements vector.
Definition: all.hpp:14531
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:20572
const ExternVarVector & get_variables() const noexcept
Getter for member variable External::variables.
Definition: all.hpp:31374
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:25767
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:31791
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:23663
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:1539
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:10141
type of ast::ThreadsafeVar
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:5738
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:19374
std::shared_ptr< Double > value
TODO.
Definition: all.hpp:19981
void set_symbol_table(symtab::SymbolTable *newsymtab) override
Set symbol table for the current ast node.
Definition: all.hpp:8152
ArgumentVector parameters
Parameters to the net receive block.
Definition: all.hpp:11291
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:8094
const std::shared_ptr< Identifier > & get_name() const noexcept
Getter for member variable PartialBoundary::name.
Definition: all.hpp:25777
int value
Value of boolean.
Definition: all.hpp:1955
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:15742
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:30428
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:34397
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:26757
Reset * clone() const override
Return a copy of the current node.
Definition: all.hpp:26678
const AssignedDefinitionVector & get_definitions() const noexcept
Getter for member variable StateBlock::definitions.
Definition: all.hpp:7348
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:8542
std::shared_ptr< Expression > reaction2
TODO.
Definition: all.hpp:27820
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:28715
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:3955
const WriteIonVarVector & get_writelist() const noexcept
Getter for member variable Useion::writelist.
Definition: all.hpp:29494
const std::shared_ptr< Unit > & get_unit() const noexcept
Getter for member variable FunctionTableBlock::unit.
Definition: all.hpp:10491
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:26463
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:11643
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:18297
Represents differential equation in DERIVATIVE block.
Definition: all.hpp:17482
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:33609
Integer * clone() const override
Return a copy of the current node.
Definition: all.hpp:1251
type of ast::QueueStatement
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:4206
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:33225
const std::shared_ptr< Unit > & get_unit() const noexcept
Getter for member variable AssignedDefinition::unit.
Definition: all.hpp:22690
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:28893
const std::shared_ptr< StatementBlock > & get_statement_block() const noexcept override
Getter for member variable FromStatement::statement_block.
Definition: all.hpp:23962
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:10114
SectionVarVector sections
Vector of section variables.
Definition: all.hpp:30111
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:18955
const std::shared_ptr< Expression > & get_expression() const noexcept
Getter for member variable PartialBoundary::expression.
Definition: all.hpp:25789
const std::shared_ptr< Number > & get_start() const noexcept
Getter for member variable IndependentDefinition::start.
Definition: all.hpp:22350
type of ast::UnaryExpression
bool is_protect_statement() const noexcept override
Check if the ast node is an instance of ast::ProtectStatement.
Definition: all.hpp:23599
DoubleUnit * clone() const override
Return a copy of the current node.
Definition: all.hpp:15037
type of ast::QueueExpressionType
std::string get_nmodl_name() const noexcept override
Return NMODL statement of ast node as std::string.
Definition: all.hpp:13540
symtab::SymbolTable * get_symbol_table() const override
Return associated symbol table for the current ast node.
Definition: all.hpp:7343
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:18868
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:5972
const std::shared_ptr< Name > & get_byname() const noexcept
Getter for member variable LagStatement::byname.
Definition: all.hpp:28251
type of ast::WhileStatement
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:8408
const std::shared_ptr< Name > & get_name() const noexcept
Getter for member variable ThreadsafeVar::name.
Definition: all.hpp:5990
BbcorePointer * clone() const override
Return a copy of the current node.
Definition: all.hpp:31074
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:12759
bool is_update_dt() const noexcept override
Check if the ast node is an instance of ast::UpdateDt.
Definition: all.hpp:34599
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:1061
bool is_match() const noexcept override
Check if the ast node is an instance of ast::Match.
Definition: all.hpp:19327
bool is_eigen_newton_solver_block() const noexcept override
Check if the ast node is an instance of ast::EigenNewtonSolverBlock.
Definition: all.hpp:33181
Represent LONGITUDINAL_DIFFUSION statement in NMODL.
Definition: all.hpp:27552
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:25447
std::vector< std::shared_ptr< IndependentDefinition > > IndependentDefinitionVector
Definition: ast_decl.hpp:431
bool is_unit() const noexcept override
Check if the ast node is an instance of ast::Unit.
Definition: all.hpp:14804
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:17813
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:29751
void set_symbol_table(symtab::SymbolTable *newsymtab) override
Set symbol table for the current ast node.
Definition: all.hpp:6522
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:34682
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:8894
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:31994
type of ast::PartialEquation
ElseIfStatement * clone() const override
Return a copy of the current node.
Definition: all.hpp:24938
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:31575
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:30226
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:3438
const std::shared_ptr< PrimeName > & get_prime() const noexcept
Getter for member variable PartialEquation::prime.
Definition: all.hpp:25480
Stepped * clone() const override
Return a copy of the current node.
Definition: all.hpp:22004
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:15052
std::string get_nmodl_name() const noexcept override
Return NMODL statement of ast node as std::string.
Definition: all.hpp:9844
NameVector depend_vars
dependent variables
Definition: all.hpp:28820
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:11141
const std::shared_ptr< Valence > & get_valence() const noexcept
Getter for member variable Useion::valence.
Definition: all.hpp:29499
Represents a boolean variable.
Definition: all.hpp:1952
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:27349
void set_symbol_table(symtab::SymbolTable *newsymtab) override
Set symbol table for the current ast node.
Definition: all.hpp:8421
symtab::SymbolTable * get_symbol_table() const override
Return associated symbol table for the current ast node.
Definition: all.hpp:9581
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:34011
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:15674
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:29185
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:5074
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:20558
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:20063
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:13545
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:13806
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:18477
bool is_terminal_block() const noexcept override
Check if the ast node is an instance of ast::TerminalBlock.
Definition: all.hpp:12173
QueueType get_value() const noexcept
Getter for member variable QueueExpressionType::value.
Definition: all.hpp:19188
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:2777
void set_symbol_table(symtab::SymbolTable *newsymtab) override
Set symbol table for the current ast node.
Definition: all.hpp:6783
std::shared_ptr< VarName > name
TODO.
Definition: all.hpp:3436
type of ast::Compartment
LagStatement * clone() const override
Return a copy of the current node.
Definition: all.hpp:28170
BABlockType * clone() const override
Return a copy of the current node.
Definition: all.hpp:19564
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:21269
std::shared_ptr< StatementBlock > statement_block
Block with statements vector.
Definition: all.hpp:12150
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:8603
std::shared_ptr< Name > del2
TODO.
Definition: all.hpp:25651
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:24988
AssignedDefinitionVector definitions
Vector of assigned variables.
Definition: all.hpp:6902
type of ast::LagStatement
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:32988
const std::shared_ptr< Double > & get_value() const noexcept
Getter for member variable FactorDef::value.
Definition: all.hpp:20107
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:19594
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:21287
bool is_sens() const noexcept override
Check if the ast node is an instance of ast::Sens.
Definition: all.hpp:26858
const std::shared_ptr< Integer > & get_order() const noexcept
Getter for member variable PrimeName::order.
Definition: all.hpp:2552
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:31829
NonspecificCurVarVector currents
Vector of non specific variables.
Definition: all.hpp:29661
NameVector names
TODO.
Definition: all.hpp:27559
Section * clone() const override
Return a copy of the current node.
Definition: all.hpp:30142
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:27405
bool is_external() const noexcept override
Check if the ast node is an instance of ast::External.
Definition: all.hpp:31286
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:28139
ThreadSafe * clone() const override
Return a copy of the current node.
Definition: all.hpp:31518
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:23126
type of ast::Identifier
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:8936
std::string get_nmodl_name() const noexcept override
Return NMODL statement of ast node as std::string.
Definition: all.hpp:6195
type of ast::PlotDeclaration
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:29765
std::string get_nmodl_name() const noexcept override
Return NMODL statement of ast node as std::string.
Definition: all.hpp:6455
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:24672
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:16588
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:16634
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:1781
symtab::SymbolTable * get_symbol_table() const override
Return associated symbol table for the current ast node.
Definition: all.hpp:33681
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:3749
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:24707
const std::shared_ptr< PlotVar > & get_name() const noexcept
Getter for member variable PlotDeclaration::name.
Definition: all.hpp:22990
type of ast::SectionVar
GlobalVar * clone() const override
Return a copy of the current node.
Definition: all.hpp:5030
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:12509
const std::shared_ptr< Name > & get_name() const noexcept
Getter for member variable ExternVar::name.
Definition: all.hpp:5770
bool is_float() const noexcept override
Check if the ast node is an instance of ast::Float.
Definition: all.hpp:1492
symtab::SymbolTable * get_symbol_table() const override
Return associated symbol table for the current ast node.
Definition: all.hpp:6494
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:31328
const NameVector & get_solvefor() const noexcept
Getter for member variable NonLinearBlock::solvefor.
Definition: all.hpp:9604
bool is_unit_block() const noexcept override
Check if the ast node is an instance of ast::UnitBlock.
Definition: all.hpp:14026
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:29948
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:30008
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:26693
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:24419
Represents CONDUCTANCE statement in NMODL.
Definition: all.hpp:23119
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:29165
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:17335
bool is_pointer_var() const noexcept override
Check if the ast node is an instance of ast::PointerVar.
Definition: all.hpp:5238
std::shared_ptr< StatementBlock > statement_block
TODO.
Definition: all.hpp:25149
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:18929
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:1293
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:9849
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:3895
bool is_plot_var() const noexcept override
Check if the ast node is an instance of ast::PlotVar.
Definition: all.hpp:15918
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:19093
void set_symbol_table(symtab::SymbolTable *newsymtab) override
Set symbol table for the current ast node.
Definition: all.hpp:11746
virtual Expression * clone() const override
Return a copy of the current node.
Definition: all.hpp:372
std::shared_ptr< Name > name
TODO.
Definition: all.hpp:19979
WriteIonVar * clone() const override
Return a copy of the current node.
Definition: all.hpp:3925
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:26570
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:32414
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:14667
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:2812
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:9307
type of ast::ParenExpression
std::shared_ptr< Number > to
TODO.
Definition: all.hpp:22540
const std::shared_ptr< Expression > & get_linxpression() const noexcept
Getter for member variable LinEquation::linxpression.
Definition: all.hpp:18285
std::shared_ptr< Double > value
TODO.
Definition: all.hpp:15002
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:28913
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:27141
StepBlock * clone() const override
Return a copy of the current node.
Definition: all.hpp:6410
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:14088
const std::shared_ptr< Name > & get_name() const noexcept
Getter for member variable ElectrodeCurVar::name.
Definition: all.hpp:4445
const ConstantStatementVector & get_statements() const noexcept
Getter for member variable ConstantBlock::statements.
Definition: all.hpp:14388
SolveBlock * clone() const override
Return a copy of the current node.
Definition: all.hpp:11613
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:17314
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:16800
void set_symbol_table(symtab::SymbolTable *newsymtab) override
Set symbol table for the current ast node.
Definition: all.hpp:9012
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:20586
PlotDeclaration * clone() const override
Return a copy of the current node.
Definition: all.hpp:22909
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:14636
PrimeName * clone() const override
Return a copy of the current node.
Definition: all.hpp:2471
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:17014
DestructorBlock * clone() const override
Return a copy of the current node.
Definition: all.hpp:8306
Name * clone() const override
Return a copy of the current node.
Definition: all.hpp:2227
const std::shared_ptr< ConstantVar > & get_constant() const noexcept
Getter for member variable ConstantStatement::constant.
Definition: all.hpp:28703
Represent NEURON block in the mod file.
Definition: all.hpp:14528
std::shared_ptr< Name > conductance
Conductance variable.
Definition: all.hpp:23122
std::shared_ptr< StatementBlock > statement_block
TODO.
Definition: all.hpp:24617
PointerVar * clone() const override
Return a copy of the current node.
Definition: all.hpp:5250
std::string get_nmodl_name() const noexcept override
Return NMODL statement of ast node as std::string.
Definition: all.hpp:21282
std::shared_ptr< String > ontology_id
Ontology to indicate the chemical ion.
Definition: all.hpp:29359
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:1049
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:7816
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:14400
std::shared_ptr< Name > name3
TODO.
Definition: all.hpp:25381
std::shared_ptr< Identifier > name
Name of the variable.
Definition: all.hpp:22534
bool is_solve_block() const noexcept override
Check if the ast node is an instance of ast::SolveBlock.
Definition: all.hpp:11601
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:5724
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:19867
NameVector solvefor
Solve for specification (TODO)
Definition: all.hpp:13456
double to_double() override
Return value of the current ast node as double.
Definition: all.hpp:1901
bool is_var_name() const noexcept override
Check if the ast node is an instance of ast::VarName.
Definition: all.hpp:2956
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:7562
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:3499
const StatementVector & get_statements() const noexcept
Getter for member variable StatementBlock::statements.
Definition: all.hpp:8704
std::string get_nmodl_name() const noexcept override
Return NMODL statement of ast node as std::string.
Definition: all.hpp:33639
bool is_net_receive_block() const noexcept override
Check if the ast node is an instance of ast::NetReceiveBlock.
Definition: all.hpp:11318
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:28467
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:19198
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:8336
std::shared_ptr< Name > name1
TODO.
Definition: all.hpp:25377
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:6726
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:28241
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:22039
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:22548
void negate() override
Negate the value of current ast node.
Definition: all.hpp:1649
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:13326
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:4676
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:2515
const std::shared_ptr< SolveBlock > & get_solve_block() const noexcept
Getter for member variable SolutionExpression::solve_block.
Definition: all.hpp:34446
const std::shared_ptr< Name > & get_name() const noexcept
Getter for member variable ProcedureBlock::name.
Definition: all.hpp:11111
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:26274
const std::shared_ptr< Number > & get_max() const noexcept
Getter for member variable NumberRange::max.
Definition: all.hpp:15773
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:24728
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:7309
GlobalVarVector variables
Vector of global variables.
Definition: all.hpp:30546
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:30113
std::string get_nmodl_name() const noexcept override
Return NMODL statement of ast node as std::string.
Definition: all.hpp:6712
Base class for all block scoped nodes.
Definition: all.hpp:498
const std::shared_ptr< StatementBlock > & get_initialize_block() const noexcept
Getter for member variable EigenLinearSolverBlock::initialize_block.
Definition: all.hpp:33702
std::shared_ptr< Expression > node_to_solve
Block to be solved (callback node or solution node itself)
Definition: all.hpp:34346
std::shared_ptr< Unit > unit
TODO.
Definition: all.hpp:21970
bool is_write_ion_var() const noexcept override
Check if the ast node is an instance of ast::WriteIonVar.
Definition: all.hpp:3913
std::string eval() const
Return value of the ast node.
Definition: all.hpp:1912
symtab::SymbolTable * get_symbol_table() const override
Return associated symbol table for the current ast node.
Definition: all.hpp:12015
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:26954
bool is_include() const noexcept override
Check if the ast node is an instance of ast::Include.
Definition: all.hpp:21476
std::shared_ptr< Integer > index
TODO.
Definition: all.hpp:15897
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:15524
const std::shared_ptr< StatementBlock > & get_statement_block() const noexcept override
Getter for member variable NetReceiveBlock::statement_block.
Definition: all.hpp:11428
type of ast::DerivimplicitCallback
type of ast::TableStatement
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:7360
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:27184
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:11670
type of ast::NonLinEquation
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:23230
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:28669
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:3200
const std::shared_ptr< StatementBlock > & get_statement_block() const noexcept override
Getter for member variable LinearBlock::statement_block.
Definition: all.hpp:9294
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:2749
std::shared_ptr< Name > name
TODO.
Definition: all.hpp:4558
PartialBoundary * clone() const override
Return a copy of the current node.
Definition: all.hpp:25696
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:18941
std::vector< std::shared_ptr< NonspecificCurVar > > NonspecificCurVarVector
Definition: ast_decl.hpp:354
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:2734
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:10389
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:10647
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:988
bool is_indexed_name() const noexcept override
Check if the ast node is an instance of ast::IndexedName.
Definition: all.hpp:2707
ForNetcon * clone() const override
Return a copy of the current node.
Definition: all.hpp:13215
bool is_mutex_unlock() const noexcept override
Check if the ast node is an instance of ast::MutexUnlock.
Definition: all.hpp:26477
std::shared_ptr< Name > name
TODO.
Definition: all.hpp:4998
std::vector< std::shared_ptr< ElectrodeCurVar > > ElectrodeCurVarVector
Definition: ast_decl.hpp:355
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:23866
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:19820
type of ast::DestructorBlock
virtual std::string get_node_name() const
Return name of of the node.
Definition: ast.cpp:29
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:9829
const std::shared_ptr< StatementBlock > & get_statement_block() const noexcept override
Getter for member variable KineticBlock::statement_block.
Definition: all.hpp:13607
const std::shared_ptr< Identifier > & get_name() const noexcept
Getter for member variable QueueStatement::name.
Definition: all.hpp:28479
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:12488
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:27162
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:1307
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:6985
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:20324
BAType value
block type
Definition: all.hpp:19533
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:11066
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:13510
type of ast::AssignedBlock
const std::shared_ptr< Unit > & get_unit() const noexcept
Getter for member variable ProcedureBlock::unit.
Definition: all.hpp:11123
std::shared_ptr< StatementBlock > statement_block
Block with statements vector.
Definition: all.hpp:7998
bool is_diff_eq_expression() const noexcept override
Check if the ast node is an instance of ast::DiffEqExpression.
Definition: all.hpp:17506
const std::shared_ptr< Expression > & get_from() const noexcept
Getter for member variable FromStatement::from.
Definition: all.hpp:23945
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:11961
std::shared_ptr< Name > type
TODO.
Definition: all.hpp:20274
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:1560
FromStatement * clone() const override
Return a copy of the current node.
Definition: all.hpp:23851
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:6221
std::string get_nmodl_name() const noexcept override
Return NMODL statement of ast node as std::string.
Definition: all.hpp:31119
Program * clone() const override
Return a copy of the current node.
Definition: all.hpp:32629
const std::shared_ptr< String > & get_ontology_id() const noexcept
Getter for member variable OntologyStatement::ontology_id.
Definition: all.hpp:32476
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:3763
type of ast::ConstructorBlock
const NameVector & get_table_vars() const noexcept
Getter for member variable TableStatement::table_vars.
Definition: all.hpp:28939
const MatchVector & get_matchs() const noexcept
Getter for member variable MatchBlock::matchs.
Definition: all.hpp:13880
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:1720
std::string eval() const
Return enum value in string form.
Definition: all.hpp:19266
const std::shared_ptr< StatementBlock > & get_initialize_block() const noexcept
Getter for member variable EigenNewtonSolverBlock::initialize_block.
Definition: all.hpp:33303
const NodeVector & get_blocks() const noexcept
Getter for member variable Program::blocks.
Definition: all.hpp:32759
StatementVector statements
Vector of statements.
Definition: all.hpp:8540
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:29744
symtab::SymbolTable * get_symbol_table() const override
Return associated symbol table for the current ast node.
Definition: all.hpp:13301
RangeVar * clone() const override
Return a copy of the current node.
Definition: all.hpp:4810
std::string get_nmodl_name() const noexcept override
Return NMODL statement of ast node as std::string.
Definition: all.hpp:14610
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:23216
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:8909
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:15289
const std::shared_ptr< Name > & get_name() const noexcept
Getter for member variable Suffix::name.
Definition: all.hpp:29229
BbcorePointerVar * clone() const override
Return a copy of the current node.
Definition: all.hpp:5471
std::shared_ptr< Name > name2
TODO.
Definition: all.hpp:25379
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:33549
AssignedBlock * clone() const override
Return a copy of the current node.
Definition: all.hpp:6935
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:11988
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:11946
type of ast::BinaryExpression
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:8999
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:34028
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:12539
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:31798
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:13862
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:17074
std::shared_ptr< Integer > with
TODO.
Definition: all.hpp:22215
bool is_ba_block_type() const noexcept override
Check if the ast node is an instance of ast::BABlockType.
Definition: all.hpp:19552
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:17360
ReactVarName * clone() const override
Return a copy of the current node.
Definition: all.hpp:3469
const std::shared_ptr< Name > & get_name() const noexcept
Getter for member variable RangeVar::name.
Definition: all.hpp:4886
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:4455
type of ast::BinaryOperator
symtab::SymbolTable * get_symbol_table() const override
Return associated symbol table for the current ast node.
Definition: all.hpp:6753
UpdateDt * clone() const override
Return a copy of the current node.
Definition: all.hpp:34611
Argument * clone() const override
Return a copy of the current node.
Definition: all.hpp:3231
MatchVector matchs
Vector of match statements.
Definition: all.hpp:13758
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:1575
const std::shared_ptr< Expression > & get_expression() const noexcept
Getter for member variable ExpressionStatement::expression.
Definition: all.hpp:23464
type of ast::ThreadSafe
const std::shared_ptr< Identifier > & get_name() const noexcept
Getter for member variable IndexedName::name.
Definition: all.hpp:2795
Represents ELECTRODE_CURRENT variables statement in NMODL.
Definition: all.hpp:29882
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:16656
const std::shared_ptr< Integer > & get_at() const noexcept
Getter for member variable VarName::at.
Definition: all.hpp:3047
NodeVector blocks
AST of the included file.
Definition: all.hpp:21455
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:27432
ParenExpression * clone() const override
Return a copy of the current node.
Definition: all.hpp:17044
Auto generated AST classes declaration.
std::shared_ptr< Name > method
Name of the integration method.
Definition: all.hpp:11571
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:21557
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:28607
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:27894
type of ast::NetReceiveBlock
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:7006
bool is_conductance_hint() const noexcept override
Check if the ast node is an instance of ast::ConductanceHint.
Definition: all.hpp:23145
Base class for all AST node.
Definition: all.hpp:43
TerminalBlock * clone() const override
Return a copy of the current node.
Definition: all.hpp:12185
FunctionBlock * clone() const override
Return a copy of the current node.
Definition: all.hpp:10683
virtual ~Node()=default
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:22085
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:8845
std::shared_ptr< ElseStatement > elses
TODO.
Definition: all.hpp:24621
Base class for all numbers.
Definition: all.hpp:811
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:26519
symtab::SymbolTable * get_symbol_table() const override
Return associated symbol table for the current ast node.
Definition: all.hpp:32698
bool is_breakpoint_block() const noexcept override
Check if the ast node is an instance of ast::BreakpointBlock.
Definition: all.hpp:11919
SteppedVector statements
Vector of statements.
Definition: all.hpp:6377
const std::shared_ptr< Double > & get_value() const noexcept
Getter for member variable DoubleUnit::value.
Definition: all.hpp:15100
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:14109
std::shared_ptr< Valence > valence
(TODO)
Definition: all.hpp:29357
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:10713
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:27364
bool is_param_block() const noexcept override
Check if the ast node is an instance of ast::ParamBlock.
Definition: all.hpp:6138
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:11684
BlockComment * clone() const override
Return a copy of the current node.
Definition: all.hpp:32174
bool eval() const
Return value of the ast node.
Definition: all.hpp:2147
IndependentDefinitionVector definitions
TODO.
Definition: all.hpp:6632
std::shared_ptr< Name > macro
if integer is a macro then it&#39;s name
Definition: all.hpp:1217
std::shared_ptr< Unit > unit
TODO.
Definition: all.hpp:21695
bool is_unit_def() const noexcept override
Check if the ast node is an instance of ast::UnitDef.
Definition: all.hpp:19766
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:32671
type of ast::SolveBlock
bool is_watch_statement() const noexcept override
Check if the ast node is an instance of ast::WatchStatement.
Definition: all.hpp:26021
std::string get_nmodl_name() const noexcept override
Return NMODL statement of ast node as std::string.
Definition: all.hpp:26721
ConstantStatementVector statements
Vector of constant statements.
Definition: all.hpp:14266
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:8356
type of ast::StatementBlock
std::vector< std::shared_ptr< Watch > > WatchVector
Definition: ast_decl.hpp:414
std::string get_nmodl_name() const noexcept override
Return NMODL statement of ast node as std::string.
Definition: all.hpp:10129
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:8929
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:14851
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:28227
void set_symbol_table(symtab::SymbolTable *newsymtab) override
Set symbol table for the current ast node.
Definition: all.hpp:12552
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:4560
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:3010
Represents NONLINEAR block in the NMODL.
Definition: all.hpp:9453
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:31606
KineticBlock * clone() const override
Return a copy of the current node.
Definition: all.hpp:13495
std::string eval() const
Return enum value in string form.
Definition: all.hpp:16974
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:25383
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:18033
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:15274
const std::shared_ptr< Unit > & get_unit() const noexcept
Getter for member variable FunctionBlock::unit.
Definition: all.hpp:10797
BeforeBlock * clone() const override
Return a copy of the current node.
Definition: all.hpp:12438
const NameVector & get_solvefor() const noexcept
Getter for member variable KineticBlock::solvefor.
Definition: all.hpp:13602
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:25212
ReactionStatement * clone() const override
Return a copy of the current node.
Definition: all.hpp:27862
Represents a double variable.
Definition: all.hpp:1715
const std::shared_ptr< Expression > & get_expression() const noexcept
Getter for member variable Watch::expression.
Definition: all.hpp:18960
StatementBlock * clone() const override
Return a copy of the current node.
Definition: all.hpp:8573
EigenNewtonSolverBlock * clone() const override
Return a copy of the current node.
Definition: all.hpp:33193
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:17791
bool is_unit_state() const noexcept override
Check if the ast node is an instance of ast::UnitState.
Definition: all.hpp:20516
std::shared_ptr< FirstLastTypeIndex > index
TODO.
Definition: all.hpp:25645
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:27302
const std::shared_ptr< StatementBlock > & get_statement_block() const noexcept override
Getter for member variable NonLinearBlock::statement_block.
Definition: all.hpp:9609
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:7316
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:20056
bool is_binary_expression() const noexcept override
Check if the ast node is an instance of ast::BinaryExpression.
Definition: all.hpp:17263
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:26371
ParamBlock * clone() const override
Return a copy of the current node.
Definition: all.hpp:6150
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:15986
StateBlock * clone() const override
Return a copy of the current node.
Definition: all.hpp:7259
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:19354
std::shared_ptr< Unit > unit
Unit if specified.
Definition: all.hpp:10643
bool is_independent_block() const noexcept override
Check if the ast node is an instance of ast::IndependentBlock.
Definition: all.hpp:6653
symtab::SymbolTable * get_symbol_table() const override
Return associated symbol table for the current ast node.
Definition: all.hpp:8963
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:7781
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:5116
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:16677
bool is_local_var() const noexcept override
Check if the ast node is an instance of ast::LocalVar.
Definition: all.hpp:15247
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:31589
bool is_solution_expression() const noexcept override
Check if the ast node is an instance of ast::SolutionExpression.
Definition: all.hpp:34368
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:27608
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:2195
void set_symbol_table(symtab::SymbolTable *newsymtab) override
Set symbol table for the current ast node.
Definition: all.hpp:14413
Represents NONSPECIFIC_CURRENT variables statement in NMODL.
Definition: all.hpp:29658
PointerVarVector variables
Vector of pointer variables.
Definition: all.hpp:30818
BAType
enum type to distinguish BEFORE or AFTER blocks
Definition: ast_common.hpp:92
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:16006
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:4840
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:32932
Represents a DEFINE statement in NMODL.
Definition: all.hpp:21201
void set_symbol_table(symtab::SymbolTable *newsymtab) override
Set symbol table for the current ast node.
Definition: all.hpp:12300
Represents a STATE block in the NMODL.
Definition: all.hpp:7223
const std::shared_ptr< Double > & get_value() const noexcept
Getter for member variable UpdateDt::value.
Definition: all.hpp:34687
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:30172
std::shared_ptr< Number > value
Value of the constant.
Definition: all.hpp:16120
static const std::string UnitStateTypeNames[]
string representation of ast::UnitStateType
Definition: ast_common.hpp:101
type of ast::EigenNewtonSolverBlock
std::string get_nmodl_name() const noexcept override
Return NMODL statement of ast node as std::string.
Definition: all.hpp:11375
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:32488
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:2322
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:6379
symtab::SymbolTable * get_symbol_table() const override
Return associated symbol table for the current ast node.
Definition: all.hpp:13027
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:5510
const std::shared_ptr< BABlockType > & get_type() const noexcept
Getter for member variable BABlock::type.
Definition: all.hpp:13032
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:7837
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:30607
const AssignedDefinitionVector & get_definitions() const noexcept
Getter for member variable AssignedBlock::definitions.
Definition: all.hpp:7085
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:2057
type of ast::DiffEqExpression
type of ast::LineComment
const std::shared_ptr< Expression > & get_reaction1() const noexcept
Getter for member variable ReactionStatement::reaction1.
Definition: all.hpp:27941
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:27666
bool is_factor_def() const noexcept override
Check if the ast node is an instance of ast::FactorDef.
Definition: all.hpp:20014
std::string get_nmodl_name() const noexcept override
Return NMODL statement of ast node as std::string.
Definition: all.hpp:24449
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:12002
WatchVector::const_iterator insert_watch(WatchVector::const_iterator position, const std::shared_ptr< Watch > &n)
Insert member to statements.
Definition: ast.cpp:10856
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:29663
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:1766
bool is_from_statement() const noexcept override
Check if the ast node is an instance of ast::FromStatement.
Definition: all.hpp:23839
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:19793
std::shared_ptr< Double > abstol
TODO.
Definition: all.hpp:22546
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:15095
std::vector< std::shared_ptr< Expression > > ExpressionVector
Definition: ast_decl.hpp:337
bool is_valence() const noexcept override
Check if the ast node is an instance of ast::Valence.
Definition: all.hpp:20297
std::shared_ptr< Name > ion
Ion name.
Definition: all.hpp:23124
std::vector< std::shared_ptr< Stepped > > SteppedVector
Definition: ast_decl.hpp:429
bool is_local_list_statement() const noexcept override
Check if the ast node is an instance of ast::LocalListStatement.
Definition: all.hpp:20727
std::shared_ptr< Name > name
Name of the function.
Definition: all.hpp:10639
std::shared_ptr< Name > del
TODO.
Definition: all.hpp:25641
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:21503
std::shared_ptr< Limits > limit
TODO.
Definition: all.hpp:21697
Represents THREADSAFE statement in NMODL.
Definition: all.hpp:31484
NetReceiveBlock * clone() const override
Return a copy of the current node.
Definition: all.hpp:11330
bool is_derivative_block() const noexcept override
Check if the ast node is an instance of ast::DerivativeBlock.
Definition: all.hpp:8867
std::shared_ptr< Number > max
TODO.
Definition: all.hpp:15672
bool is_node() const noexcept override
Check if the ast node is an instance of ast::Node.
Definition: all.hpp:57
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:10337
BbcorePointerVarVector variables
Vector of bbcore pointer variables.
Definition: all.hpp:31043
ExpressionVector arguments
TODO.
Definition: all.hpp:18414
bool is_step_block() const noexcept override
Check if the ast node is an instance of ast::StepBlock.
Definition: all.hpp:6398
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:1957
std::shared_ptr< Name > name
TODO.
Definition: all.hpp:5662
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:28200
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:21254
std::shared_ptr< StatementBlock > statement_block
Block with statements vector.
Definition: all.hpp:11896
bool is_string() const noexcept override
Check if the ast node is an instance of ast::String.
Definition: all.hpp:1007
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:22939
std::shared_ptr< StatementBlock > statement_block
TODO.
Definition: all.hpp:23812
const std::shared_ptr< Limits > & get_limit() const noexcept
Getter for member variable ParamAssign::limit.
Definition: all.hpp:21824
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:7555
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:21972
std::shared_ptr< Expression > expression
TODO.
Definition: all.hpp:19306
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:5287
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:17777
std::shared_ptr< StatementBlock > setup_x_block
update X from states
Definition: all.hpp:33543
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:22705
std::shared_ptr< Boolean > gt
Todo: Michael : rename variable gt as well.
Definition: all.hpp:19985
bool is_paren_expression() const noexcept override
Check if the ast node is an instance of ast::ParenExpression.
Definition: all.hpp:17032
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:18171
Represents CURIE information in NMODL.
Definition: all.hpp:32362
bool is_after_block() const noexcept override
Check if the ast node is an instance of ast::AfterBlock.
Definition: all.hpp:12690
std::vector< std::shared_ptr< AssignedDefinition > > AssignedDefinitionVector
Definition: ast_decl.hpp:433
std::string eval() const
Return enum value in string form.
Definition: all.hpp:16760
ForAllStatement * clone() const override
Return a copy of the current node.
Definition: all.hpp:24158
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:26939
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:9232
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:14068
const std::shared_ptr< Number > & get_to() const noexcept
Getter for member variable IndependentDefinition::to.
Definition: all.hpp:22340
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:6950
const std::shared_ptr< Name > & get_name() const noexcept
Getter for member variable IndependentDefinition::name.
Definition: all.hpp:22330
const std::shared_ptr< Expression > & get_from() const noexcept
Getter for member variable TableStatement::from.
Definition: all.hpp:28949
Represents a multi-line comment in NMODL.
Definition: all.hpp:32139
virtual AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:701
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:17702
const ArgumentVector & get_parameters() const noexcept override
Getter for member variable NetReceiveBlock::parameters.
Definition: all.hpp:11421
const std::shared_ptr< Double > & get_abstol() const noexcept
Getter for member variable AssignedDefinition::abstol.
Definition: all.hpp:22695
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:9147
const std::shared_ptr< Expression > & get_expression1() const noexcept
Getter for member variable ReactionStatement::expression1.
Definition: all.hpp:27960
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:7289
std::shared_ptr< Name > name
Name of the kinetic block.
Definition: all.hpp:13454
std::shared_ptr< Expression > from
from value
Definition: all.hpp:28822
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:6440
const std::shared_ptr< Name > & get_macro() const noexcept
Getter for member variable Integer::macro.
Definition: all.hpp:1317
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:15115
std::vector< std::shared_ptr< SectionVar > > SectionVarVector
Definition: ast_decl.hpp:356
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:9568
bool is_thread_safe() const noexcept override
Check if the ast node is an instance of ast::ThreadSafe.
Definition: all.hpp:31506
bool is_eigen_linear_solver_block() const noexcept override
Check if the ast node is an instance of ast::EigenLinearSolverBlock.
Definition: all.hpp:33580
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:13821
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:21543
const std::shared_ptr< Expression > & get_rhs() const noexcept
Getter for member variable NonLinEquation::rhs.
Definition: all.hpp:18043
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:34412
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:16663
bool is_table_statement() const noexcept override
Check if the ast node is an instance of ast::TableStatement.
Definition: all.hpp:28851
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:6904
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:16891
const std::shared_ptr< StatementBlock > & get_setup_x_block() const noexcept
Getter for member variable EigenNewtonSolverBlock::setup_x_block.
Definition: all.hpp:33310
type of ast::AfterBlock
const std::shared_ptr< Identifier > & get_name() const noexcept
Getter for member variable LocalVar::name.
Definition: all.hpp:15335
std::shared_ptr< Name > name
Name of the function table block.
Definition: all.hpp:10331
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:26885
std::shared_ptr< Expression > index
index value in case of array
Definition: all.hpp:2934
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:31533
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:24434
double to_double() override
Return value of the current ast node as double.
Definition: all.hpp:1654
const ReactionOperator & get_op() const noexcept
Getter for member variable ReactionStatement::op.
Definition: all.hpp:27948
symtab::SymbolTable * get_symbol_table() const override
Return associated symbol table for the current ast node.
Definition: all.hpp:8644
std::string eval() const
Return value of the ast node.
Definition: all.hpp:1665
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:18721
const std::shared_ptr< StatementBlock > & get_statement_block() const noexcept override
Getter for member variable TerminalBlock::statement_block.
Definition: all.hpp:12274
std::shared_ptr< String > name
TODO.
Definition: all.hpp:14784
std::string get_nmodl_name() const noexcept override
Return NMODL statement of ast node as std::string.
Definition: all.hpp:22954
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:20278
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:16186
bool is_else_statement() const noexcept override
Check if the ast node is an instance of ast::ElseStatement.
Definition: all.hpp:25170
symtab::SymbolTable * get_symbol_table() const override
Return associated symbol table for the current ast node.
Definition: all.hpp:10461
const std::shared_ptr< Name > & get_name() const noexcept
Getter for member variable LinearBlock::name.
Definition: all.hpp:9284
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:32224
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:30190
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:3791
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:2016
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:17931
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:14900
const std::shared_ptr< Name > & get_name() const noexcept
Getter for member variable Compartment::name.
Definition: all.hpp:27410
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:13000
Conserve * clone() const override
Return a copy of the current node.
Definition: all.hpp:27091
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:8087
ExternVar * clone() const override
Return a copy of the current node.
Definition: all.hpp:5694
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:13525
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:14095
std::shared_ptr< Identifier > name
Name of the variable.
Definition: all.hpp:28376
Base class for all identifiers.
Definition: all.hpp:660
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:18012
UnitBlock * clone() const override
Return a copy of the current node.
Definition: all.hpp:14038
ElseIfStatementVector elseifs
TODO.
Definition: all.hpp:24619
std::shared_ptr< Number > value
TODO.
Definition: all.hpp:21693
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:19622
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:34661
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:19808
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:31934
const std::shared_ptr< Block > & get_node_to_solve() const noexcept
Getter for member variable DerivimplicitCallback::node_to_solve.
Definition: all.hpp:34229
symtab::SymbolTable * get_symbol_table() const override
Return associated symbol table for the current ast node.
Definition: all.hpp:8390
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:12993
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:15783
std::shared_ptr< Name > type
type of channel
Definition: all.hpp:29115
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:30374
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:19579
std::shared_ptr< StatementBlock > initialize_block
Statement block to be executed before calling linear solver.
Definition: all.hpp:33541
const std::shared_ptr< Expression > & get_node_to_solve() const noexcept
Getter for member variable SolutionExpression::node_to_solve.
Definition: all.hpp:34453
const std::shared_ptr< Name > & get_del() const noexcept
Getter for member variable PartialBoundary::del.
Definition: all.hpp:25772
virtual std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:876
bool is_reaction_statement() const noexcept override
Check if the ast node is an instance of ast::ReactionStatement.
Definition: all.hpp:27850
const std::shared_ptr< ElseStatement > & get_elses() const noexcept
Getter for member variable IfStatement::elses.
Definition: all.hpp:24753
std::string get_nmodl_name() const noexcept override
Return NMODL statement of ast node as std::string.
Definition: all.hpp:6980
const std::shared_ptr< BinaryExpression > & get_expression() const noexcept
Getter for member variable DiffEqExpression::expression.
Definition: all.hpp:17583
bool is_prime_name() const noexcept override
Check if the ast node is an instance of ast::PrimeName.
Definition: all.hpp:2459
type of ast::Argument
std::string eval() const
Return value of the ast node.
Definition: all.hpp:1166
Represents block encapsulating list of statements.
Definition: all.hpp:8537
const std::shared_ptr< Expression > & get_expression() const noexcept
Getter for member variable Compartment::expression.
Definition: all.hpp:27415
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:16171
Abstract base class for all constant visitors implementation.
Definition: visitor.hpp:340
std::shared_ptr< Expression > linxpression
TODO.
Definition: all.hpp:18169
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:15074
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:14831
Represent RESET statement in NMODL.
Definition: all.hpp:26649
type of ast::IfStatement
type of ast::ParamAssign
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:2562
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:33646
type of ast::FunctionTableBlock
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:6992
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:34697
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:16444
const std::shared_ptr< Name > & get_name3() const noexcept
Getter for member variable PartialBoundary::name3.
Definition: all.hpp:25811
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:30414
bool is_suffix() const noexcept override
Check if the ast node is an instance of ast::Suffix.
Definition: all.hpp:29138
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:5929
type of ast::TerminalBlock
NrnStateBlock * clone() const override
Return a copy of the current node.
Definition: all.hpp:32917
ProcedureBlock * clone() const override
Return a copy of the current node.
Definition: all.hpp:11009
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:6965
const std::shared_ptr< StatementBlock > & get_statement_block() const noexcept override
Getter for member variable BABlock::statement_block.
Definition: all.hpp:13037
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:18484
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:30904
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:13245
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:33989
std::shared_ptr< Name > name
TODO.
Definition: all.hpp:27555
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:6697
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:3064
const std::shared_ptr< Name > & get_method() const noexcept
Getter for member variable SolveBlock::method.
Definition: all.hpp:11709
SolutionExpression * clone() const override
Return a copy of the current node.
Definition: all.hpp:34380
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:9462
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:6000
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:27121
bool is_lon_difuse() const noexcept override
Check if the ast node is an instance of ast::LonDifuse.
Definition: all.hpp:27581
virtual void visit_children(visitor::Visitor &v) override
visit children i.e.
Definition: ast.cpp:353
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:24188
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:23252
type of ast::OntologyStatement
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:25009
NumberRange * clone() const override
Return a copy of the current node.
Definition: all.hpp:15705
std::shared_ptr< Name > name
TODO.
Definition: all.hpp:4113
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:12406
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:11733
bool is_plot_block() const noexcept override
Check if the ast node is an instance of ast::PlotBlock.
Definition: all.hpp:7506
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:13288
MutexLock * clone() const override
Return a copy of the current node.
Definition: all.hpp:26300
type of ast::BlockComment
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:14370
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:31812
bool is_program() const noexcept override
Check if the ast node is an instance of ast::Program.
Definition: all.hpp:32617
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:4648
const std::shared_ptr< Boolean > & get_sweep() const noexcept
Getter for member variable IndependentDefinition::sweep.
Definition: all.hpp:22325
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:16649
const std::shared_ptr< StatementBlock > & get_statement_block() const noexcept override
Getter for member variable WhileStatement::statement_block.
Definition: all.hpp:24487
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:9512
std::shared_ptr< Expression > to
to values
Definition: all.hpp:28824
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:23000
const ExpressionVector & get_definitions() const noexcept
Getter for member variable UnitBlock::definitions.
Definition: all.hpp:14127
const std::shared_ptr< Name > & get_name() const noexcept
Getter for member variable SectionVar::name.
Definition: all.hpp:4666
void set_symbol_table(symtab::SymbolTable *newsymtab) override
Set symbol table for the current ast node.
Definition: all.hpp:12046
const std::shared_ptr< Number > & get_start() const noexcept
Getter for member variable AssignedDefinition::start.
Definition: all.hpp:22685
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:21791
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:3675
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:21066
std::shared_ptr< Unit > unit1
TODO.
Definition: all.hpp:19983
const std::shared_ptr< Name > & get_name() const noexcept
Getter for member variable DerivativeBlock::name.
Definition: all.hpp:8981
std::string get_nmodl_name() const noexcept override
Return NMODL statement of ast node as std::string.
Definition: all.hpp:27136
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:28920
std::shared_ptr< StatementBlock > statement_block
Block with statements vector.
Definition: all.hpp:9460
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:34641
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:30407
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:26357
type of ast::DerivativeBlock
bool is_read_ion_var() const noexcept override
Check if the ast node is an instance of ast::ReadIonVar.
Definition: all.hpp:3693
std::shared_ptr< StatementBlock > statement_block
Block with statements vector.
Definition: all.hpp:9763
const std::shared_ptr< Name > & get_name() const noexcept
Getter for member variable GlobalVar::name.
Definition: all.hpp:5106
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:12242
const std::shared_ptr< Expression > & get_lhs() const noexcept
Getter for member variable NonLinEquation::lhs.
Definition: all.hpp:18038
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:30716
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:22046
virtual std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:416
const BinaryOperator & get_op() const noexcept
Getter for member variable BinaryExpression::op.
Definition: all.hpp:17345
std::shared_ptr< Expression > condition
TODO.
Definition: all.hpp:24615
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:2283
const std::shared_ptr< Expression > & get_expression() const noexcept
Getter for member variable LonDifuse::expression.
Definition: all.hpp:27676
std::shared_ptr< BinaryExpression > expression
Differential Expression.
Definition: all.hpp:17485
std::shared_ptr< StatementBlock > statement_block
Block with statements vector.
Definition: all.hpp:10645
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:30918
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:10698
std::shared_ptr< StatementBlock > statement_block
Block with statements vector.
Definition: all.hpp:9145
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:25821
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:18538
ArgumentVector parameters
Vector of the parameters.
Definition: all.hpp:10333
std::shared_ptr< Name > name
TODO.
Definition: all.hpp:21966
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:19161
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:10426
const NameVector & get_names() const noexcept
Getter for member variable LonDifuse::names.
Definition: all.hpp:27683
symtab::SymbolTable * get_symbol_table() const override
Return associated symbol table for the current ast node.
Definition: all.hpp:10767
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:28934
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:15345
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:8588
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:29206
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:10501
ReactionOp value
TODO.
Definition: all.hpp:16798
std::shared_ptr< Name > name
Name of ion.
Definition: all.hpp:29351
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:18728
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:20365
std::string get_nmodl_name() const noexcept override
Return NMODL statement of ast node as std::string.
Definition: all.hpp:31786
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:25726
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:17088
symtab::SymbolTable * get_symbol_table() const override
Return associated symbol table for the current ast node.
Definition: all.hpp:11697
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:9212
type of ast::ReactionOperator
void set_symbol_table(symtab::SymbolTable *newsymtab) override
Set symbol table for the current ast node.
Definition: all.hpp:13063
BinaryOp value
Operator.
Definition: all.hpp:16374
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:5503
const std::shared_ptr< Expression > & get_expression2() const noexcept
Getter for member variable ReactionStatement::expression2.
Definition: all.hpp:27967
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:31269
std::shared_ptr< Name > name3
TODO.
Definition: all.hpp:25655
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:4854
ElectrodeCurrent * clone() const override
Return a copy of the current node.
Definition: all.hpp:29916
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:6740
bool is_state_block() const noexcept override
Check if the ast node is an instance of ast::StateBlock.
Definition: all.hpp:7247
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:20041
Nonspecific * clone() const override
Return a copy of the current node.
Definition: all.hpp:29692
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:22980
static const std::string QueueTypeNames[]
string representation of ast::QueueType
Definition: ast_common.hpp:89
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:26652
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:14872
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:7576
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:33148
std::string get_nmodl_name() const noexcept override
Return NMODL statement of ast node as std::string.
Definition: all.hpp:8080
const ArgumentVector & get_parameters() const noexcept override
Getter for member variable ProcedureBlock::parameters.
Definition: all.hpp:11116
std::shared_ptr< Integer > n_state_vars
number of state vars used in solve
Definition: all.hpp:33537
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:1793
symtab::SymbolTable * get_symbol_table() const override
Return associated symbol table for the current ast node.
Definition: all.hpp:14122
void set_symbol_table(symtab::SymbolTable *newsymtab) override
Set symbol table for the current ast node.
Definition: all.hpp:7881
Represents EXTERNAL statement in NMODL.
Definition: all.hpp:31264
std::string eval() const
Return enum value in string form.
Definition: all.hpp:18826
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:15749
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:10051
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:13566
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:7274
const std::shared_ptr< Unit > & get_unit() const noexcept
Getter for member variable Stepped::unit.
Definition: all.hpp:22075
const std::shared_ptr< Expression > & get_condition() const noexcept
Getter for member variable WhileStatement::condition.
Definition: all.hpp:24480
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:3962
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:22298
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:29977
const std::shared_ptr< Expression > & get_increment() const noexcept
Getter for member variable FromStatement::increment.
Definition: all.hpp:23955
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:29361
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:27652
void set_symbol_table(symtab::SymbolTable *newsymtab) override
Set symbol table for the current ast node.
Definition: all.hpp:13903
static const std::string UnaryOpNames[]
string representation of ast::UnaryOp
Definition: ast_common.hpp:77
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:8377
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:16200
bool is_bbcore_pointer_var() const noexcept override
Check if the ast node is an instance of ast::BbcorePointerVar.
Definition: all.hpp:5459
std::shared_ptr< BABlock > bablock
Block to be called before.
Definition: all.hpp:12404
bool is_for_all_statement() const noexcept override
Check if the ast node is an instance of ast::ForAllStatement.
Definition: all.hpp:24146
Abstract base class for all visitors implementation.
Definition: visitor.hpp:39
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:26841
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:30879
type of ast::ElectrodeCurVar
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:20791
const std::shared_ptr< Unit > & get_unit() const noexcept
Getter for member variable ConstantVar::unit.
Definition: all.hpp:16242
std::shared_ptr< Name > name
Name of the variable.
Definition: all.hpp:16118
void set_symbol_table(symtab::SymbolTable *newsymtab) override
Set symbol table for the current ast node.
Definition: all.hpp:11154
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:26330
BinaryOp
enum Type for binary operators in NMODL
Definition: ast_common.hpp:47
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:21208
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:33920
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:26350
std::shared_ptr< Double > min
TODO.
Definition: all.hpp:15447
virtual std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:99
const std::string & get_value() const noexcept
Getter for member variable Float::value.
Definition: all.hpp:1565
std::string get_nmodl_name() const noexcept override
Return NMODL statement of ast node as std::string.
Definition: all.hpp:27379
virtual void set_name(const std::string &name)
Set name for the AST node.
Definition: ast.cpp:47
std::shared_ptr< Name > name
TODO.
Definition: all.hpp:24122
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:24905
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:31164
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:22276
const std::shared_ptr< Expression > & get_expression() const noexcept
Getter for member variable WrappedExpression::expression.
Definition: all.hpp:34016
const std::shared_ptr< String > & get_statement() const noexcept
Getter for member variable BlockComment::statement.
Definition: all.hpp:32250
bool is_plot_declaration() const noexcept override
Check if the ast node is an instance of ast::PlotDeclaration.
Definition: all.hpp:22897
const ReadIonVarVector & get_readlist() const noexcept
Getter for member variable Useion::readlist.
Definition: all.hpp:29489
std::shared_ptr< StatementBlock > variable_block
Statements to be declared in the functor.
Definition: all.hpp:33136
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:33269
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:4011
type of ast::WatchStatement
const std::shared_ptr< BABlock > & get_bablock() const noexcept
Getter for member variable BeforeBlock::bablock.
Definition: all.hpp:12527
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:32947
const NameVector & get_names() const noexcept
Getter for member variable Compartment::names.
Definition: all.hpp:27422
void set_symbol_table(symtab::SymbolTable *newsymtab) override
Set symbol table for the current ast node.
Definition: all.hpp:10217
std::string get_nmodl_name() const noexcept override
Return NMODL statement of ast node as std::string.
Definition: all.hpp:24702
int get_value() const noexcept
Getter for member variable Integer::value.
Definition: all.hpp:1312
std::shared_ptr< Number > start
TODO.
Definition: all.hpp:22542
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:15960
Represent COMPARTMENT statement in NMODL.
Definition: all.hpp:27293
bool is_statement_block() const noexcept override
Check if the ast node is an instance of ast::StatementBlock.
Definition: all.hpp:8561
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:13267
const std::shared_ptr< Identifier > & get_name() const noexcept
Getter for member variable ParamAssign::name.
Definition: all.hpp:21809
bool is_boolean() const noexcept override
Check if the ast node is an instance of ast::Boolean.
Definition: all.hpp:1974
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:17977
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:17321
Model * clone() const override
Return a copy of the current node.
Definition: all.hpp:21018
std::shared_ptr< Unit > unit2
TODO.
Definition: all.hpp:19987
std::string get_nmodl_name() const noexcept override
Return NMODL statement of ast node as std::string.
Definition: all.hpp:24203
const std::shared_ptr< StatementBlock > & get_variable_block() const noexcept
Getter for member variable EigenNewtonSolverBlock::variable_block.
Definition: all.hpp:33295
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:24229
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:27979
UnitStateType get_value() const noexcept
Getter for member variable UnitState::value.
Definition: all.hpp:20591
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:32974
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:25432
const std::shared_ptr< Expression > & get_rhs() const noexcept
Getter for member variable BinaryExpression::rhs.
Definition: all.hpp:17350
UnaryExpression * clone() const override
Return a copy of the current node.
Definition: all.hpp:17733
LonDifuse * clone() const override
Return a copy of the current node.
Definition: all.hpp:27593
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:23187
std::string eval() const
Return enum value in string form.
Definition: all.hpp:16548
const std::shared_ptr< Name > & get_name() const noexcept
Getter for member variable FunctionBlock::name.
Definition: all.hpp:10785
std::shared_ptr< Name > name
TODO.
Definition: all.hpp:18412
Represents a statement in ASSIGNED or STATE block.
Definition: all.hpp:22531
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:31756
type of ast::IndependentDefinition
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:20344
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:23975
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:6467
std::shared_ptr< StatementBlock > statement_block
Block with statements vector.
Definition: all.hpp:12923
Statement to indicate a change in timestep in a given block.
Definition: all.hpp:34576
static const std::string FirstLastTypeNames[]
string representation of ast::FirstLastType
Definition: ast_common.hpp:83
std::shared_ptr< BABlockType > type
Type of NMODL block.
Definition: all.hpp:12921
Unit * clone() const override
Return a copy of the current node.
Definition: all.hpp:14816
NameVector names
TODO.
Definition: all.hpp:27300
bool is_unary_expression() const noexcept override
Check if the ast node is an instance of ast::UnaryExpression.
Definition: all.hpp:17721
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:12925
virtual std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:113
std::shared_ptr< Identifier > name
TODO.
Definition: all.hpp:21691
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:9197
const std::string & get_value() const noexcept
Getter for member variable Double::value.
Definition: all.hpp:1812
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:7533
std::string get_nmodl_name() const noexcept override
Return NMODL statement of ast node as std::string.
Definition: all.hpp:7304
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:5531
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:19535
PartialBlock * clone() const override
Return a copy of the current node.
Definition: all.hpp:10084
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:32685
Represents a variable in the ast::ConstantBlock.
Definition: all.hpp:16115
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:27936
Suffix * clone() const override
Return a copy of the current node.
Definition: all.hpp:29150
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:27106
int get_value() const noexcept
Getter for member variable Boolean::value.
Definition: all.hpp:2047
bool is_constant_block() const noexcept override
Check if the ast node is an instance of ast::ConstantBlock.
Definition: all.hpp:14287
type of ast::LinEquation
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:17119
std::shared_ptr< Name > name2
TODO.
Definition: all.hpp:25653
type of ast::FirstLastTypeIndex
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:5709
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:1822
std::shared_ptr< StatementBlock > finalize_block
Statement block to be executed after calling newton solver.
Definition: all.hpp:33146
const std::shared_ptr< Identifier > & get_name() const noexcept
Getter for member variable Argument::name.
Definition: all.hpp:3307
WrappedExpression * clone() const override
Return a copy of the current node.
Definition: all.hpp:33950
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:20339
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:30625
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:18505
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:7330
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:2688
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:27384
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:5951
const std::shared_ptr< StatementBlock > & get_statement_block() const noexcept override
Getter for member variable BreakpointBlock::statement_block.
Definition: all.hpp:12020
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:14846
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:3322
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:34668
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:23476
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:24173
UnitDef * clone() const override
Return a copy of the current node.
Definition: all.hpp:19778
bool is_argument() const noexcept override
Check if the ast node is an instance of ast::Argument.
Definition: all.hpp:3219
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:18273
ConstantVar * clone() const override
Return a copy of the current node.
Definition: all.hpp:16156
std::shared_ptr< Expression > rhs
TODO.
Definition: all.hpp:17929
void negate() override
Negate the value of current ast node.
Definition: all.hpp:1411
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:27623
symtab::ModelSymbolTable model_symtab
global symbol table for model
Definition: all.hpp:32598
Represents a PARAMETER block in the NMODL.
Definition: all.hpp:6114
type of ast::KineticBlock
bool is_integer() const noexcept override
Check if the ast node is an instance of ast::Integer.
Definition: all.hpp:1239
virtual std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:248
bool is_first_last_type_index() const noexcept override
Check if the ast node is an instance of ast::FirstLastTypeIndex.
Definition: all.hpp:18670
const std::shared_ptr< Expression > & get_expression() const noexcept
Getter for member variable Match::expression.
Definition: all.hpp:19405
QueueExpressionType * clone() const override
Return a copy of the current node.
Definition: all.hpp:19122
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:14007
type of ast::SolutionExpression
bool is_mutex_lock() const noexcept override
Check if the ast node is an instance of ast::MutexLock.
Definition: all.hpp:26288
const std::shared_ptr< Expression > & get_lhs() const noexcept
Getter for member variable BinaryExpression::lhs.
Definition: all.hpp:17340
std::shared_ptr< Name > byname
Name of the variable (TODO)
Definition: all.hpp:28137
const std::shared_ptr< StatementBlock > & get_statement_block() const noexcept override
Getter for member variable ElseIfStatement::statement_block.
Definition: all.hpp:25021
int eval() const
Return value of the ast node.
Definition: all.hpp:1427
virtual double to_double()
Definition: all.hpp:824
StatementVector::const_iterator insert_statement(StatementVector::const_iterator position, const std::shared_ptr< Statement > &n)
Insert member to statements.
Definition: ast.cpp:2965
type of ast::Statement
std::string eval() const
Return enum value in string form.
Definition: all.hpp:20669
bool is_conserve() const noexcept override
Check if the ast node is an instance of ast::Conserve.
Definition: all.hpp:27079
std::shared_ptr< Expression > rhs
RHS of the binary expression.
Definition: all.hpp:17240
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:13848
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:33653
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:25197
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:10204
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:16870
Represents a PLOT statement in the NMODL.
Definition: all.hpp:7481
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:28185
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:12033
virtual Node * clone() const override
Return a copy of the current node.
Definition: all.hpp:69
Represents a INDEPENDENT block in the NMODL.
Definition: all.hpp:6629
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:21770
std::vector< std::shared_ptr< ConstantStatement > > ConstantStatementVector
Definition: ast_decl.hpp:458
bool is_function_table_block() const noexcept override
Check if the ast node is an instance of ast::FunctionTableBlock.
Definition: all.hpp:10360
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:4780
bool is_expression_statement() const noexcept override
Check if the ast node is an instance of ast::ExpressionStatement.
Definition: all.hpp:23386
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:19834
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:16422
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:8050
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:30389
std::string get_nmodl_name() const noexcept override
Return NMODL statement of ast node as std::string.
Definition: all.hpp:12483
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:3024
void set_symbol_table(symtab::SymbolTable *newsymtab) override
Set symbol table for the current ast node.
Definition: all.hpp:9635
void set_symbol_table(symtab::SymbolTable *newsymtab) override
Set symbol table for the current ast node.
Definition: all.hpp:7373
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:23701
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:12200
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:14329
Represent MUTEXUNLOCK statement in NMODL.
Definition: all.hpp:26460
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:24500
UnitStateType
enum type used for UNIT_ON or UNIT_OFF state
Definition: ast_common.hpp:98
DiscreteBlock * clone() const override
Return a copy of the current node.
Definition: all.hpp:9799
std::string get_nmodl_name() const noexcept override
Return NMODL statement of ast node as std::string.
Definition: all.hpp:32444
DiffEqExpression * clone() const override
Return a copy of the current node.
Definition: all.hpp:17518
Represents USEION statement in NMODL.
Definition: all.hpp:29348
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:16906
std::string get_nmodl_name() const noexcept override
Return NMODL statement of ast node as std::string.
Definition: all.hpp:26078
bool is_assigned_block() const noexcept override
Check if the ast node is an instance of ast::AssignedBlock.
Definition: all.hpp:6923
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:12773
std::vector< std::shared_ptr< WriteIonVar > > WriteIonVarVector
Definition: ast_decl.hpp:353
Represent WATCH statement in NMODL.
Definition: all.hpp:25999
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:11295
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:18053
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:19308
type of ast::ElectrodeCurrent
std::shared_ptr< Number > to
TODO.
Definition: all.hpp:22213
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:7097
virtual std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:409
const PlotVarVector & get_variables() const noexcept
Getter for member variable PlotDeclaration::variables.
Definition: all.hpp:22985
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:12973
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:5752
std::shared_ptr< Identifier > name
TODO.
Definition: all.hpp:19304
std::shared_ptr< Name > name
Name of the partial block.
Definition: all.hpp:10047
bool is_range_var() const noexcept override
Check if the ast node is an instance of ast::RangeVar.
Definition: all.hpp:4798
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:15735
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:2042
std::shared_ptr< ModToken > token
token with location information
Definition: all.hpp:11898
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:1286
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:32967
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:32471
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:1327
bool is_ontology_statement() const noexcept override
Check if the ast node is an instance of ast::OntologyStatement.
Definition: all.hpp:32385
type of ast::AssignedDefinition
std::shared_ptr< Unit > unit
Unit if specified.
Definition: all.hpp:10969
const std::shared_ptr< Name > & get_name() const noexcept
Getter for member variable PartialBlock::name.
Definition: all.hpp:10186
std::string get_node_type_name() const noexcept override
Return type (ast::AstNodeType) of ast node as std::string.
Definition: all.hpp:33624
std::shared_ptr< Double > value
TODO.
Definition: all.hpp:20276
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:29933
InitialBlock * clone() const override
Return a copy of the current node.
Definition: all.hpp:7766
SectionVar * clone() const override
Return a copy of the current node.
Definition: all.hpp:4590
symtab::SymbolTable * get_symbol_table() const override
Return associated symbol table for the current ast node.
Definition: all.hpp:9883
Represent newton solver solution block based on Eigen.
Definition: all.hpp:33131
const std::shared_ptr< Name > & get_del2() const noexcept
Getter for member variable PartialBoundary::del2.
Definition: all.hpp:25801
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:1519
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:14053
std::shared_ptr< Expression > expression
Expression that is being wrapped.
Definition: all.hpp:33918
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:4427
const std::shared_ptr< Number > & get_min() const noexcept
Getter for member variable NumberRange::min.
Definition: all.hpp:15768
UnaryOp get_value() const noexcept
Getter for member variable UnaryOperator::value.
Definition: all.hpp:16682
bool is_block_comment() const noexcept override
Check if the ast node is an instance of ast::BlockComment.
Definition: all.hpp:32162
StatementVector solve_statements
solve blocks to be called or generated
Definition: all.hpp:32884
std::shared_ptr< Ast > get_shared_ptr() override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:4406
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:5517
const ModToken * get_token() const noexcept override
Return associated token for the current ast node.
Definition: all.hpp:29466
void set_token(const ModToken &tok)
Set token for the current ast node.
Definition: all.hpp:7868
AstNodeType get_node_type() const noexcept override
Return type (ast::AstNodeType) of ast node.
Definition: all.hpp:34626
bool is_expression() const noexcept override
Check if the ast node is an instance of ast::Expression.
Definition: all.hpp:360
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:11389
std::shared_ptr< const Ast > get_shared_ptr() const override
Get std::shared_ptr from this pointer of the current ast node.
Definition: all.hpp:28453
virtual Number * clone() const override
Return a copy of the current node.
Definition: all.hpp:846